[{"data":1,"prerenderedAt":27385},["ShallowReactive",2],{"article_list_jquery_":3},[4,3972,5375,8721,14803,15174,16864,18420,21115,23958],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"publishDate":11,"tags":12,"excerpt":10,"body":16,"_type":3963,"_id":3964,"_source":3965,"_file":3966,"_stem":3967,"_extension":3968,"author":3969},"/ckeefer/2016-7/gofetch2","2016-7",false,"","Go Fetch 2! (JavaScript Fetch API)","Last time we discussed the Fetch API in general, taking a look at how it differed from the XMLHttpRequest API, and some of its advantages. Today, we're going to take a look at a little library that you can include in your projects today that offers you localStorage caching for the Fetch API.","2016-10-10",[13,14,15],"js","jquery","series",{"type":17,"children":18,"toc":3956},"root",[19,34,41,56,62,76,104,117,122,128,142,148,153,183,865,884,1218,1231,1237,1250,3950],{"type":20,"tag":21,"props":22,"children":23},"element","p",{},[24,32],{"type":20,"tag":25,"props":26,"children":28},"a",{"href":27},"/search/user:ckeefer/go/fetch",[29],{"type":30,"value":31},"text","Last time",{"type":30,"value":33}," we discussed the Fetch API in general, taking a look at how it differed from the XMLHttpRequest API, and some of its advantages. Today, we're going to take a look at a little library that you can include in your projects today that offers you localStorage caching for the Fetch API.",{"type":20,"tag":35,"props":36,"children":38},"h3",{"id":37},"tlwr",[39],{"type":30,"value":40},"TL;WR",{"type":20,"tag":21,"props":42,"children":43},{},[44,46,54],{"type":30,"value":45},"If you're anxious to get to the good stuff, you can head straight to the ",{"type":20,"tag":25,"props":47,"children":51},{"href":48,"rel":49},"https://github.com/SaneMethod/fetchCache",[50],"nofollow",[52],{"type":30,"value":53},"fetchCache Github Repo",{"type":30,"value":55},".",{"type":20,"tag":35,"props":57,"children":59},{"id":58},"cache-control",[60],{"type":30,"value":61},"Cache Control",{"type":20,"tag":21,"props":63,"children":64},{},[65,67,74],{"type":30,"value":66},"Before we get started, those of you more familiar with the Fetch API might be wondering why we need to use localStorage for caching fetch request responses at all. Isn't that what the ",{"type":20,"tag":68,"props":69,"children":71},"code",{"className":70},[],[72],{"type":30,"value":73},"cache",{"type":30,"value":75}," property in the fetch settings is for?",{"type":20,"tag":21,"props":77,"children":78},{},[79,81,87,89,95,96,102],{"type":30,"value":80},"Yes and no. The cache setting allows you greater control over the standard HTTP cache, so that you don't need to use the old trick of appending a datetime string to your request for 'cache-busting' purposes, as you might have done in the past with XHR. Instead, you can simply specify ",{"type":20,"tag":68,"props":82,"children":84},{"className":83},[],[85],{"type":30,"value":86},"cache:'no-store'",{"type":30,"value":88}," or ",{"type":20,"tag":68,"props":90,"children":92},{"className":91},[],[93],{"type":30,"value":94},"cache:'no-cache'",{"type":30,"value":88},{"type":20,"tag":68,"props":97,"children":99},{"className":98},[],[100],{"type":30,"value":101},"cache:'reload'",{"type":30,"value":103},", depending on your use case.",{"type":20,"tag":21,"props":105,"children":106},{},[107,109,115],{"type":30,"value":108},"You can also bypass a network request (potentially useful for offline usage) and pull from the HTTP cache via ",{"type":20,"tag":68,"props":110,"children":112},{"className":111},[],[113],{"type":30,"value":114},"cache:'force-cache'",{"type":30,"value":116},", which appears to accomplish one of the goals of caching in localStorage.",{"type":20,"tag":21,"props":118,"children":119},{},[120],{"type":30,"value":121},"However, that's as far as our control over the cache goes. We can't specify how long we want items to remain in the cache, or what requests line up with which contents of the cache, or validate the contents of the cache before returning them. For that, we need to wrap fetch with a bit of custom logic to allow us to handle the caching ourselves.",{"type":20,"tag":35,"props":123,"children":125},{"id":124},"looks-familiar",[126],{"type":30,"value":127},"Looks Familiar",{"type":20,"tag":21,"props":129,"children":130},{},[131,133,140],{"type":30,"value":132},"Just before we dive in, you may find that the API I'm about to present looks familiar - maybe because you've used ",{"type":20,"tag":25,"props":134,"children":137},{"href":135,"rel":136},"https://github.com/SaneMethod/jquery-ajax-localstorage-cache",[50],[138],{"type":30,"value":139},"JALC",{"type":30,"value":141},", the plugin for similar caching with jQuery.ajax. The API similarity is most definitely on purpose, and you should feel comfortable moving from one to the other.",{"type":20,"tag":35,"props":143,"children":145},{"id":144},"the-breakdown",[146],{"type":30,"value":147},"The Breakdown",{"type":20,"tag":21,"props":149,"children":150},{},[151],{"type":30,"value":152},"So, let's take a look at the code, and discuss what's happening.",{"type":20,"tag":21,"props":154,"children":155},{},[156,158,165,167,173,175,181],{"type":30,"value":157},"For those of you who've used JALC, much of this will look familiar, and you can reference ",{"type":20,"tag":25,"props":159,"children":162},{"href":160,"rel":161},"https://artandlogic.com/2013/06/ajax-caching-transports-compatible-with-jquery-deferred/",[50],[163],{"type":30,"value":164},"this previous breakdown of the core parts of JALC for more details",{"type":30,"value":166},", so we'll skip over those. Let's take a look at our ",{"type":20,"tag":68,"props":168,"children":170},{"className":169},[],[171],{"type":30,"value":172},"cacheResponse",{"type":30,"value":174}," and ",{"type":20,"tag":68,"props":176,"children":178},{"className":177},[],[179],{"type":30,"value":180},"provideResponse",{"type":30,"value":182}," functions, as they're the juicy bits.",{"type":20,"tag":184,"props":185,"children":189},"pre",{"className":186,"code":187,"language":188,"meta":8,"style":8},"language-javascript shiki shiki-themes github-light github-dark","   /**\n    * Cache the response into our storage object.\n    * We clone the response so that we can drain the stream without making it\n    * unavailable to future handlers.\n    *\n    * @param {string} cacheKey Key under which to cache the data string. Bound in\n    * fetch override.\n    * @param {Storage} storage Object implementing Storage interface to store cached data\n    * (text or json exclusively) in. Bound in fetch override.\n    * @param {Number} hourstl Number of hours this value shoud remain in the cache.\n    * Bound in fetch override.\n    * @param {Response} response\n    */\nfunction cacheResponse(cacheKey, storage, hourstl, response) {\n    var cres = response.clone(),\n        dataType = (response.headers.get('Content-Type') || 'text/plain').toLowerCase();\n\n    cres.text().then((text) => {\n        try {\n            storage.setItem(cacheKey, text);\n            storage.setItem(cacheKey + 'cachettl', +new Date() + 1000 * 60 * 60 * hourstl);\n            storage.setItem(cacheKey + 'dataType', dataType);\n        } catch (e) {\n            // Remove any incomplete data that may have been saved before the exception was caught\n            removeFromStorage(storage, cacheKey);\n            console.log('Cache Error: ' + e, cacheKey, text);\n        }\n    });\n\n    return response;\n}\n\n","javascript",[190],{"type":20,"tag":68,"props":191,"children":192},{"__ignoreMap":8},[193,205,214,223,232,241,273,282,309,318,345,354,376,385,443,477,540,550,596,609,628,711,741,760,769,783,816,825,834,842,856],{"type":20,"tag":194,"props":195,"children":198},"span",{"class":196,"line":197},"line",1,[199],{"type":20,"tag":194,"props":200,"children":202},{"style":201},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[203],{"type":30,"value":204},"   /**\n",{"type":20,"tag":194,"props":206,"children":208},{"class":196,"line":207},2,[209],{"type":20,"tag":194,"props":210,"children":211},{"style":201},[212],{"type":30,"value":213},"    * Cache the response into our storage object.\n",{"type":20,"tag":194,"props":215,"children":217},{"class":196,"line":216},3,[218],{"type":20,"tag":194,"props":219,"children":220},{"style":201},[221],{"type":30,"value":222},"    * We clone the response so that we can drain the stream without making it\n",{"type":20,"tag":194,"props":224,"children":226},{"class":196,"line":225},4,[227],{"type":20,"tag":194,"props":228,"children":229},{"style":201},[230],{"type":30,"value":231},"    * unavailable to future handlers.\n",{"type":20,"tag":194,"props":233,"children":235},{"class":196,"line":234},5,[236],{"type":20,"tag":194,"props":237,"children":238},{"style":201},[239],{"type":30,"value":240},"    *\n",{"type":20,"tag":194,"props":242,"children":244},{"class":196,"line":243},6,[245,250,256,262,268],{"type":20,"tag":194,"props":246,"children":247},{"style":201},[248],{"type":30,"value":249},"    * ",{"type":20,"tag":194,"props":251,"children":253},{"style":252},"--shiki-default:#D73A49;--shiki-dark:#F97583",[254],{"type":30,"value":255},"@param",{"type":20,"tag":194,"props":257,"children":259},{"style":258},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[260],{"type":30,"value":261}," {string}",{"type":20,"tag":194,"props":263,"children":265},{"style":264},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[266],{"type":30,"value":267}," cacheKey",{"type":20,"tag":194,"props":269,"children":270},{"style":201},[271],{"type":30,"value":272}," Key under which to cache the data string. Bound in\n",{"type":20,"tag":194,"props":274,"children":276},{"class":196,"line":275},7,[277],{"type":20,"tag":194,"props":278,"children":279},{"style":201},[280],{"type":30,"value":281},"    * fetch override.\n",{"type":20,"tag":194,"props":283,"children":285},{"class":196,"line":284},8,[286,290,294,299,304],{"type":20,"tag":194,"props":287,"children":288},{"style":201},[289],{"type":30,"value":249},{"type":20,"tag":194,"props":291,"children":292},{"style":252},[293],{"type":30,"value":255},{"type":20,"tag":194,"props":295,"children":296},{"style":258},[297],{"type":30,"value":298}," {Storage}",{"type":20,"tag":194,"props":300,"children":301},{"style":264},[302],{"type":30,"value":303}," storage",{"type":20,"tag":194,"props":305,"children":306},{"style":201},[307],{"type":30,"value":308}," Object implementing Storage interface to store cached data\n",{"type":20,"tag":194,"props":310,"children":312},{"class":196,"line":311},9,[313],{"type":20,"tag":194,"props":314,"children":315},{"style":201},[316],{"type":30,"value":317},"    * (text or json exclusively) in. Bound in fetch override.\n",{"type":20,"tag":194,"props":319,"children":321},{"class":196,"line":320},10,[322,326,330,335,340],{"type":20,"tag":194,"props":323,"children":324},{"style":201},[325],{"type":30,"value":249},{"type":20,"tag":194,"props":327,"children":328},{"style":252},[329],{"type":30,"value":255},{"type":20,"tag":194,"props":331,"children":332},{"style":258},[333],{"type":30,"value":334}," {Number}",{"type":20,"tag":194,"props":336,"children":337},{"style":264},[338],{"type":30,"value":339}," hourstl",{"type":20,"tag":194,"props":341,"children":342},{"style":201},[343],{"type":30,"value":344}," Number of hours this value shoud remain in the cache.\n",{"type":20,"tag":194,"props":346,"children":348},{"class":196,"line":347},11,[349],{"type":20,"tag":194,"props":350,"children":351},{"style":201},[352],{"type":30,"value":353},"    * Bound in fetch override.\n",{"type":20,"tag":194,"props":355,"children":357},{"class":196,"line":356},12,[358,362,366,371],{"type":20,"tag":194,"props":359,"children":360},{"style":201},[361],{"type":30,"value":249},{"type":20,"tag":194,"props":363,"children":364},{"style":252},[365],{"type":30,"value":255},{"type":20,"tag":194,"props":367,"children":368},{"style":258},[369],{"type":30,"value":370}," {Response}",{"type":20,"tag":194,"props":372,"children":373},{"style":264},[374],{"type":30,"value":375}," response\n",{"type":20,"tag":194,"props":377,"children":379},{"class":196,"line":378},13,[380],{"type":20,"tag":194,"props":381,"children":382},{"style":201},[383],{"type":30,"value":384},"    */\n",{"type":20,"tag":194,"props":386,"children":388},{"class":196,"line":387},14,[389,394,399,404,410,415,420,424,429,433,438],{"type":20,"tag":194,"props":390,"children":391},{"style":252},[392],{"type":30,"value":393},"function",{"type":20,"tag":194,"props":395,"children":396},{"style":258},[397],{"type":30,"value":398}," cacheResponse",{"type":20,"tag":194,"props":400,"children":401},{"style":264},[402],{"type":30,"value":403},"(",{"type":20,"tag":194,"props":405,"children":407},{"style":406},"--shiki-default:#E36209;--shiki-dark:#FFAB70",[408],{"type":30,"value":409},"cacheKey",{"type":20,"tag":194,"props":411,"children":412},{"style":264},[413],{"type":30,"value":414},", ",{"type":20,"tag":194,"props":416,"children":417},{"style":406},[418],{"type":30,"value":419},"storage",{"type":20,"tag":194,"props":421,"children":422},{"style":264},[423],{"type":30,"value":414},{"type":20,"tag":194,"props":425,"children":426},{"style":406},[427],{"type":30,"value":428},"hourstl",{"type":20,"tag":194,"props":430,"children":431},{"style":264},[432],{"type":30,"value":414},{"type":20,"tag":194,"props":434,"children":435},{"style":406},[436],{"type":30,"value":437},"response",{"type":20,"tag":194,"props":439,"children":440},{"style":264},[441],{"type":30,"value":442},") {\n",{"type":20,"tag":194,"props":444,"children":446},{"class":196,"line":445},15,[447,452,457,462,467,472],{"type":20,"tag":194,"props":448,"children":449},{"style":252},[450],{"type":30,"value":451},"    var",{"type":20,"tag":194,"props":453,"children":454},{"style":264},[455],{"type":30,"value":456}," cres ",{"type":20,"tag":194,"props":458,"children":459},{"style":252},[460],{"type":30,"value":461},"=",{"type":20,"tag":194,"props":463,"children":464},{"style":264},[465],{"type":30,"value":466}," response.",{"type":20,"tag":194,"props":468,"children":469},{"style":258},[470],{"type":30,"value":471},"clone",{"type":20,"tag":194,"props":473,"children":474},{"style":264},[475],{"type":30,"value":476},"(),\n",{"type":20,"tag":194,"props":478,"children":480},{"class":196,"line":479},16,[481,486,490,495,500,504,510,515,520,525,530,535],{"type":20,"tag":194,"props":482,"children":483},{"style":264},[484],{"type":30,"value":485},"        dataType ",{"type":20,"tag":194,"props":487,"children":488},{"style":252},[489],{"type":30,"value":461},{"type":20,"tag":194,"props":491,"children":492},{"style":264},[493],{"type":30,"value":494}," (response.headers.",{"type":20,"tag":194,"props":496,"children":497},{"style":258},[498],{"type":30,"value":499},"get",{"type":20,"tag":194,"props":501,"children":502},{"style":264},[503],{"type":30,"value":403},{"type":20,"tag":194,"props":505,"children":507},{"style":506},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[508],{"type":30,"value":509},"'Content-Type'",{"type":20,"tag":194,"props":511,"children":512},{"style":264},[513],{"type":30,"value":514},") ",{"type":20,"tag":194,"props":516,"children":517},{"style":252},[518],{"type":30,"value":519},"||",{"type":20,"tag":194,"props":521,"children":522},{"style":506},[523],{"type":30,"value":524}," 'text/plain'",{"type":20,"tag":194,"props":526,"children":527},{"style":264},[528],{"type":30,"value":529},").",{"type":20,"tag":194,"props":531,"children":532},{"style":258},[533],{"type":30,"value":534},"toLowerCase",{"type":20,"tag":194,"props":536,"children":537},{"style":264},[538],{"type":30,"value":539},"();\n",{"type":20,"tag":194,"props":541,"children":543},{"class":196,"line":542},17,[544],{"type":20,"tag":194,"props":545,"children":547},{"emptyLinePlaceholder":546},true,[548],{"type":30,"value":549},"\n",{"type":20,"tag":194,"props":551,"children":553},{"class":196,"line":552},18,[554,559,563,568,573,578,582,586,591],{"type":20,"tag":194,"props":555,"children":556},{"style":264},[557],{"type":30,"value":558},"    cres.",{"type":20,"tag":194,"props":560,"children":561},{"style":258},[562],{"type":30,"value":30},{"type":20,"tag":194,"props":564,"children":565},{"style":264},[566],{"type":30,"value":567},"().",{"type":20,"tag":194,"props":569,"children":570},{"style":258},[571],{"type":30,"value":572},"then",{"type":20,"tag":194,"props":574,"children":575},{"style":264},[576],{"type":30,"value":577},"((",{"type":20,"tag":194,"props":579,"children":580},{"style":406},[581],{"type":30,"value":30},{"type":20,"tag":194,"props":583,"children":584},{"style":264},[585],{"type":30,"value":514},{"type":20,"tag":194,"props":587,"children":588},{"style":252},[589],{"type":30,"value":590},"=>",{"type":20,"tag":194,"props":592,"children":593},{"style":264},[594],{"type":30,"value":595}," {\n",{"type":20,"tag":194,"props":597,"children":599},{"class":196,"line":598},19,[600,605],{"type":20,"tag":194,"props":601,"children":602},{"style":252},[603],{"type":30,"value":604},"        try",{"type":20,"tag":194,"props":606,"children":607},{"style":264},[608],{"type":30,"value":595},{"type":20,"tag":194,"props":610,"children":612},{"class":196,"line":611},20,[613,618,623],{"type":20,"tag":194,"props":614,"children":615},{"style":264},[616],{"type":30,"value":617},"            storage.",{"type":20,"tag":194,"props":619,"children":620},{"style":258},[621],{"type":30,"value":622},"setItem",{"type":20,"tag":194,"props":624,"children":625},{"style":264},[626],{"type":30,"value":627},"(cacheKey, text);\n",{"type":20,"tag":194,"props":629,"children":631},{"class":196,"line":630},21,[632,636,640,645,650,655,659,664,669,674,678,684,689,694,698,702,706],{"type":20,"tag":194,"props":633,"children":634},{"style":264},[635],{"type":30,"value":617},{"type":20,"tag":194,"props":637,"children":638},{"style":258},[639],{"type":30,"value":622},{"type":20,"tag":194,"props":641,"children":642},{"style":264},[643],{"type":30,"value":644},"(cacheKey ",{"type":20,"tag":194,"props":646,"children":647},{"style":252},[648],{"type":30,"value":649},"+",{"type":20,"tag":194,"props":651,"children":652},{"style":506},[653],{"type":30,"value":654}," 'cachettl'",{"type":20,"tag":194,"props":656,"children":657},{"style":264},[658],{"type":30,"value":414},{"type":20,"tag":194,"props":660,"children":661},{"style":252},[662],{"type":30,"value":663},"+new",{"type":20,"tag":194,"props":665,"children":666},{"style":258},[667],{"type":30,"value":668}," Date",{"type":20,"tag":194,"props":670,"children":671},{"style":264},[672],{"type":30,"value":673},"() ",{"type":20,"tag":194,"props":675,"children":676},{"style":252},[677],{"type":30,"value":649},{"type":20,"tag":194,"props":679,"children":681},{"style":680},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[682],{"type":30,"value":683}," 1000",{"type":20,"tag":194,"props":685,"children":686},{"style":252},[687],{"type":30,"value":688}," *",{"type":20,"tag":194,"props":690,"children":691},{"style":680},[692],{"type":30,"value":693}," 60",{"type":20,"tag":194,"props":695,"children":696},{"style":252},[697],{"type":30,"value":688},{"type":20,"tag":194,"props":699,"children":700},{"style":680},[701],{"type":30,"value":693},{"type":20,"tag":194,"props":703,"children":704},{"style":252},[705],{"type":30,"value":688},{"type":20,"tag":194,"props":707,"children":708},{"style":264},[709],{"type":30,"value":710}," hourstl);\n",{"type":20,"tag":194,"props":712,"children":714},{"class":196,"line":713},22,[715,719,723,727,731,736],{"type":20,"tag":194,"props":716,"children":717},{"style":264},[718],{"type":30,"value":617},{"type":20,"tag":194,"props":720,"children":721},{"style":258},[722],{"type":30,"value":622},{"type":20,"tag":194,"props":724,"children":725},{"style":264},[726],{"type":30,"value":644},{"type":20,"tag":194,"props":728,"children":729},{"style":252},[730],{"type":30,"value":649},{"type":20,"tag":194,"props":732,"children":733},{"style":506},[734],{"type":30,"value":735}," 'dataType'",{"type":20,"tag":194,"props":737,"children":738},{"style":264},[739],{"type":30,"value":740},", dataType);\n",{"type":20,"tag":194,"props":742,"children":744},{"class":196,"line":743},23,[745,750,755],{"type":20,"tag":194,"props":746,"children":747},{"style":264},[748],{"type":30,"value":749},"        } ",{"type":20,"tag":194,"props":751,"children":752},{"style":252},[753],{"type":30,"value":754},"catch",{"type":20,"tag":194,"props":756,"children":757},{"style":264},[758],{"type":30,"value":759}," (e) {\n",{"type":20,"tag":194,"props":761,"children":763},{"class":196,"line":762},24,[764],{"type":20,"tag":194,"props":765,"children":766},{"style":201},[767],{"type":30,"value":768},"            // Remove any incomplete data that may have been saved before the exception was caught\n",{"type":20,"tag":194,"props":770,"children":772},{"class":196,"line":771},25,[773,778],{"type":20,"tag":194,"props":774,"children":775},{"style":258},[776],{"type":30,"value":777},"            removeFromStorage",{"type":20,"tag":194,"props":779,"children":780},{"style":264},[781],{"type":30,"value":782},"(storage, cacheKey);\n",{"type":20,"tag":194,"props":784,"children":786},{"class":196,"line":785},26,[787,792,797,801,806,811],{"type":20,"tag":194,"props":788,"children":789},{"style":264},[790],{"type":30,"value":791},"            console.",{"type":20,"tag":194,"props":793,"children":794},{"style":258},[795],{"type":30,"value":796},"log",{"type":20,"tag":194,"props":798,"children":799},{"style":264},[800],{"type":30,"value":403},{"type":20,"tag":194,"props":802,"children":803},{"style":506},[804],{"type":30,"value":805},"'Cache Error: '",{"type":20,"tag":194,"props":807,"children":808},{"style":252},[809],{"type":30,"value":810}," +",{"type":20,"tag":194,"props":812,"children":813},{"style":264},[814],{"type":30,"value":815}," e, cacheKey, text);\n",{"type":20,"tag":194,"props":817,"children":819},{"class":196,"line":818},27,[820],{"type":20,"tag":194,"props":821,"children":822},{"style":264},[823],{"type":30,"value":824},"        }\n",{"type":20,"tag":194,"props":826,"children":828},{"class":196,"line":827},28,[829],{"type":20,"tag":194,"props":830,"children":831},{"style":264},[832],{"type":30,"value":833},"    });\n",{"type":20,"tag":194,"props":835,"children":837},{"class":196,"line":836},29,[838],{"type":20,"tag":194,"props":839,"children":840},{"emptyLinePlaceholder":546},[841],{"type":30,"value":549},{"type":20,"tag":194,"props":843,"children":845},{"class":196,"line":844},30,[846,851],{"type":20,"tag":194,"props":847,"children":848},{"style":252},[849],{"type":30,"value":850},"    return",{"type":20,"tag":194,"props":852,"children":853},{"style":264},[854],{"type":30,"value":855}," response;\n",{"type":20,"tag":194,"props":857,"children":859},{"class":196,"line":858},31,[860],{"type":20,"tag":194,"props":861,"children":862},{"style":264},[863],{"type":30,"value":864},"}\n",{"type":20,"tag":21,"props":866,"children":867},{},[868,870,875,877,882],{"type":30,"value":869},"The interesting bit here is you'll see we clone the response. This is so we can 'drain' it with the ",{"type":20,"tag":68,"props":871,"children":873},{"className":872},[],[874],{"type":30,"value":30},{"type":30,"value":876}," reader and store the results, without making the response unavailable to future promise handler blocks. By cloning the response, we get a buffered clone of the response value that we can do with as we wish, and we can pass the original response on to be handled however the future ",{"type":20,"tag":68,"props":878,"children":880},{"className":879},[],[881],{"type":30,"value":572},{"type":30,"value":883}," blocks wish to.",{"type":20,"tag":184,"props":885,"children":887},{"className":186,"code":886,"language":188,"meta":8,"style":8},"   /**\n    * Create a new response containing the cached value, and return a promise\n    * that resolves with this response.\n    *\n    * @param value\n    * @param dataType\n    * @returns {Promise}\n    */\nfunction provideResponse(value, dataType) {\n    var response = new Response(\n        value,\n        {\n            status: 200,\n            statusText: 'success',\n            headers: {\n                'Content-Type': dataType\n            }\n        }\n    );\n\n    return new Promise(function (resolve, reject) {\n        resolve(response);\n    });\n}\n",[888],{"type":20,"tag":68,"props":889,"children":890},{"__ignoreMap":8},[891,898,906,914,921,937,953,970,977,1011,1042,1050,1058,1076,1093,1101,1114,1122,1129,1137,1144,1191,1204,1211],{"type":20,"tag":194,"props":892,"children":893},{"class":196,"line":197},[894],{"type":20,"tag":194,"props":895,"children":896},{"style":201},[897],{"type":30,"value":204},{"type":20,"tag":194,"props":899,"children":900},{"class":196,"line":207},[901],{"type":20,"tag":194,"props":902,"children":903},{"style":201},[904],{"type":30,"value":905},"    * Create a new response containing the cached value, and return a promise\n",{"type":20,"tag":194,"props":907,"children":908},{"class":196,"line":216},[909],{"type":20,"tag":194,"props":910,"children":911},{"style":201},[912],{"type":30,"value":913},"    * that resolves with this response.\n",{"type":20,"tag":194,"props":915,"children":916},{"class":196,"line":225},[917],{"type":20,"tag":194,"props":918,"children":919},{"style":201},[920],{"type":30,"value":240},{"type":20,"tag":194,"props":922,"children":923},{"class":196,"line":234},[924,928,932],{"type":20,"tag":194,"props":925,"children":926},{"style":201},[927],{"type":30,"value":249},{"type":20,"tag":194,"props":929,"children":930},{"style":252},[931],{"type":30,"value":255},{"type":20,"tag":194,"props":933,"children":934},{"style":264},[935],{"type":30,"value":936}," value\n",{"type":20,"tag":194,"props":938,"children":939},{"class":196,"line":243},[940,944,948],{"type":20,"tag":194,"props":941,"children":942},{"style":201},[943],{"type":30,"value":249},{"type":20,"tag":194,"props":945,"children":946},{"style":252},[947],{"type":30,"value":255},{"type":20,"tag":194,"props":949,"children":950},{"style":264},[951],{"type":30,"value":952}," dataType\n",{"type":20,"tag":194,"props":954,"children":955},{"class":196,"line":275},[956,960,965],{"type":20,"tag":194,"props":957,"children":958},{"style":201},[959],{"type":30,"value":249},{"type":20,"tag":194,"props":961,"children":962},{"style":252},[963],{"type":30,"value":964},"@returns",{"type":20,"tag":194,"props":966,"children":967},{"style":258},[968],{"type":30,"value":969}," {Promise}\n",{"type":20,"tag":194,"props":971,"children":972},{"class":196,"line":284},[973],{"type":20,"tag":194,"props":974,"children":975},{"style":201},[976],{"type":30,"value":384},{"type":20,"tag":194,"props":978,"children":979},{"class":196,"line":311},[980,984,989,993,998,1002,1007],{"type":20,"tag":194,"props":981,"children":982},{"style":252},[983],{"type":30,"value":393},{"type":20,"tag":194,"props":985,"children":986},{"style":258},[987],{"type":30,"value":988}," provideResponse",{"type":20,"tag":194,"props":990,"children":991},{"style":264},[992],{"type":30,"value":403},{"type":20,"tag":194,"props":994,"children":995},{"style":406},[996],{"type":30,"value":997},"value",{"type":20,"tag":194,"props":999,"children":1000},{"style":264},[1001],{"type":30,"value":414},{"type":20,"tag":194,"props":1003,"children":1004},{"style":406},[1005],{"type":30,"value":1006},"dataType",{"type":20,"tag":194,"props":1008,"children":1009},{"style":264},[1010],{"type":30,"value":442},{"type":20,"tag":194,"props":1012,"children":1013},{"class":196,"line":320},[1014,1018,1023,1027,1032,1037],{"type":20,"tag":194,"props":1015,"children":1016},{"style":252},[1017],{"type":30,"value":451},{"type":20,"tag":194,"props":1019,"children":1020},{"style":264},[1021],{"type":30,"value":1022}," response ",{"type":20,"tag":194,"props":1024,"children":1025},{"style":252},[1026],{"type":30,"value":461},{"type":20,"tag":194,"props":1028,"children":1029},{"style":252},[1030],{"type":30,"value":1031}," new",{"type":20,"tag":194,"props":1033,"children":1034},{"style":258},[1035],{"type":30,"value":1036}," Response",{"type":20,"tag":194,"props":1038,"children":1039},{"style":264},[1040],{"type":30,"value":1041},"(\n",{"type":20,"tag":194,"props":1043,"children":1044},{"class":196,"line":347},[1045],{"type":20,"tag":194,"props":1046,"children":1047},{"style":264},[1048],{"type":30,"value":1049},"        value,\n",{"type":20,"tag":194,"props":1051,"children":1052},{"class":196,"line":356},[1053],{"type":20,"tag":194,"props":1054,"children":1055},{"style":264},[1056],{"type":30,"value":1057},"        {\n",{"type":20,"tag":194,"props":1059,"children":1060},{"class":196,"line":378},[1061,1066,1071],{"type":20,"tag":194,"props":1062,"children":1063},{"style":264},[1064],{"type":30,"value":1065},"            status: ",{"type":20,"tag":194,"props":1067,"children":1068},{"style":680},[1069],{"type":30,"value":1070},"200",{"type":20,"tag":194,"props":1072,"children":1073},{"style":264},[1074],{"type":30,"value":1075},",\n",{"type":20,"tag":194,"props":1077,"children":1078},{"class":196,"line":387},[1079,1084,1089],{"type":20,"tag":194,"props":1080,"children":1081},{"style":264},[1082],{"type":30,"value":1083},"            statusText: ",{"type":20,"tag":194,"props":1085,"children":1086},{"style":506},[1087],{"type":30,"value":1088},"'success'",{"type":20,"tag":194,"props":1090,"children":1091},{"style":264},[1092],{"type":30,"value":1075},{"type":20,"tag":194,"props":1094,"children":1095},{"class":196,"line":445},[1096],{"type":20,"tag":194,"props":1097,"children":1098},{"style":264},[1099],{"type":30,"value":1100},"            headers: {\n",{"type":20,"tag":194,"props":1102,"children":1103},{"class":196,"line":479},[1104,1109],{"type":20,"tag":194,"props":1105,"children":1106},{"style":506},[1107],{"type":30,"value":1108},"                'Content-Type'",{"type":20,"tag":194,"props":1110,"children":1111},{"style":264},[1112],{"type":30,"value":1113},": dataType\n",{"type":20,"tag":194,"props":1115,"children":1116},{"class":196,"line":542},[1117],{"type":20,"tag":194,"props":1118,"children":1119},{"style":264},[1120],{"type":30,"value":1121},"            }\n",{"type":20,"tag":194,"props":1123,"children":1124},{"class":196,"line":552},[1125],{"type":20,"tag":194,"props":1126,"children":1127},{"style":264},[1128],{"type":30,"value":824},{"type":20,"tag":194,"props":1130,"children":1131},{"class":196,"line":598},[1132],{"type":20,"tag":194,"props":1133,"children":1134},{"style":264},[1135],{"type":30,"value":1136},"    );\n",{"type":20,"tag":194,"props":1138,"children":1139},{"class":196,"line":611},[1140],{"type":20,"tag":194,"props":1141,"children":1142},{"emptyLinePlaceholder":546},[1143],{"type":30,"value":549},{"type":20,"tag":194,"props":1145,"children":1146},{"class":196,"line":630},[1147,1151,1155,1160,1164,1168,1173,1178,1182,1187],{"type":20,"tag":194,"props":1148,"children":1149},{"style":252},[1150],{"type":30,"value":850},{"type":20,"tag":194,"props":1152,"children":1153},{"style":252},[1154],{"type":30,"value":1031},{"type":20,"tag":194,"props":1156,"children":1157},{"style":680},[1158],{"type":30,"value":1159}," Promise",{"type":20,"tag":194,"props":1161,"children":1162},{"style":264},[1163],{"type":30,"value":403},{"type":20,"tag":194,"props":1165,"children":1166},{"style":252},[1167],{"type":30,"value":393},{"type":20,"tag":194,"props":1169,"children":1170},{"style":264},[1171],{"type":30,"value":1172}," (",{"type":20,"tag":194,"props":1174,"children":1175},{"style":406},[1176],{"type":30,"value":1177},"resolve",{"type":20,"tag":194,"props":1179,"children":1180},{"style":264},[1181],{"type":30,"value":414},{"type":20,"tag":194,"props":1183,"children":1184},{"style":406},[1185],{"type":30,"value":1186},"reject",{"type":20,"tag":194,"props":1188,"children":1189},{"style":264},[1190],{"type":30,"value":442},{"type":20,"tag":194,"props":1192,"children":1193},{"class":196,"line":713},[1194,1199],{"type":20,"tag":194,"props":1195,"children":1196},{"style":258},[1197],{"type":30,"value":1198},"        resolve",{"type":20,"tag":194,"props":1200,"children":1201},{"style":264},[1202],{"type":30,"value":1203},"(response);\n",{"type":20,"tag":194,"props":1205,"children":1206},{"class":196,"line":743},[1207],{"type":20,"tag":194,"props":1208,"children":1209},{"style":264},[1210],{"type":30,"value":833},{"type":20,"tag":194,"props":1212,"children":1213},{"class":196,"line":762},[1214],{"type":20,"tag":194,"props":1215,"children":1216},{"style":264},[1217],{"type":30,"value":864},{"type":20,"tag":21,"props":1219,"children":1220},{},[1221,1223,1229],{"type":30,"value":1222},"Here's the last really interesting bit, and it demonstrates the advantage of having access to the ",{"type":20,"tag":68,"props":1224,"children":1226},{"className":1225},[],[1227],{"type":30,"value":1228},"Response",{"type":30,"value":1230}," primitive - we can create our own streamable response by simply feeding in the value to the Response constructor, and return a new Promise as the fetch API expects immediately resolving with our response.",{"type":20,"tag":35,"props":1232,"children":1234},{"id":1233},"all-together-now",[1235],{"type":30,"value":1236},"All Together Now",{"type":20,"tag":21,"props":1238,"children":1239},{},[1240,1242,1248],{"type":30,"value":1241},"Here's the full code as of the time of this writing, and I recommend taking a look at the ",{"type":20,"tag":25,"props":1243,"children":1245},{"href":48,"rel":1244},[50],[1246],{"type":30,"value":1247},"github repo",{"type":30,"value":1249}," for the up-to-date version. As always, let me know if you have any questions in the comments.",{"type":20,"tag":184,"props":1251,"children":1253},{"className":186,"code":1252,"language":188,"meta":8,"style":8},"/**\n * Copyright (c) Christopher Keefer, 2016.\n * https://github.com/SaneMethod/fetchCache\n *\n * Override fetch in the global context to allow us to cache the response to fetch in a Storage interface\n * implementing object (such as localStorage).\n */\n(function (fetch) {\n    /* If the context doesn't support fetch, we won't attempt to patch in our\n     caching using fetch, for obvious reasons. */\n    if (!fetch) return;\n\n    /**\n     * Generate the cache key under which to store the local data - either the cache key supplied,\n     * or one generated from the url, the Content-type header (if specified) and the body (if specified).\n     *\n     * @returns {string}\n     */\n    function genCacheKey(url, settings) {\n        var {headers:{'Content-type': type}} = ('headers' in settings) ? settings : {headers: {}},\n            {body} = settings;\n\n        return settings.cacheKey || url + (type || '') + (body || '');\n    }\n\n    /**\n     * Determine whether we're using localStorage or, if the user has specified something other than a boolean\n     * value for options.localCache, whether the value appears to satisfy the plugin's requirements.\n     * Otherwise, throw a new TypeError indicating what type of value we expect.\n     *\n     * @param {boolean|object} storage\n     * @returns {boolean|object}\n     */\n    function getStorage(storage) {\n        if (!storage) return false;\n        if (storage === true) return self.localStorage;\n        if (typeof storage === \"object\" && 'getItem' in storage &&\n            'removeItem' in storage && 'setItem' in storage) {\n            return storage;\n        }\n        throw new TypeError(\"localCache must either be a boolean value, \" +\n            \"or an object which implements the Storage interface.\");\n    }\n\n    /**\n     * Remove the item specified by cacheKey and its attendant meta items from storage.\n     *\n     * @param {Storage|object} storage\n     * @param {string} cacheKey\n     */\n    function removeFromStorage(storage, cacheKey) {\n        storage.removeItem(cacheKey);\n        storage.removeItem(cacheKey + 'cachettl');\n        storage.removeItem(cacheKey + 'dataType');\n    }\n\n    /**\n     * Cache the response into our storage object.\n     * We clone the response so that we can drain the stream without making it\n     * unavailable to future handlers.\n     *\n     * @param {string} cacheKey Key under which to cache the data string. Bound in\n     * fetch override.\n     * @param {Storage} storage Object implementing Storage interface to store cached data\n     * (text or json exclusively) in. Bound in fetch override.\n     * @param {Number} hourstl Number of hours this value shoud remain in the cache.\n     * Bound in fetch override.\n     * @param {Response} response\n     */\n    function cacheResponse(cacheKey, storage, hourstl, response) {\n        var cres = response.clone(),\n            dataType = (response.headers.get('Content-Type') || 'text/plain').toLowerCase();\n\n        cres.text().then((text) => {\n            try {\n                storage.setItem(cacheKey, text);\n                storage.setItem(cacheKey + 'cachettl', +new Date() + 1000 * 60 * 60 * hourstl);\n                storage.setItem(cacheKey + 'dataType', dataType);\n            } catch (e) {\n                // Remove any incomplete data that may have been saved before the exception was caught\n                removeFromStorage(storage, cacheKey);\n                console.log('Cache Error: ' + e, cacheKey, text);\n            }\n        });\n\n        return response;\n    }\n\n    /**\n     * Create a new response containing the cached value, and return a promise\n     * that resolves with this response.\n     *\n     * @param value\n     * @param dataType\n     * @returns {Promise}\n     */\n    function provideResponse(value, dataType) {\n        var response = new Response(\n            value,\n            {\n                status: 200,\n                statusText: 'success',\n                headers: {\n                    'Content-Type': dataType\n                }\n            }\n        );\n\n        return new Promise(function (resolve, reject) {\n            resolve(response);\n        });\n    }\n\n    /**\n     * Override fetch on the global context, so that we can intercept\n     * fetch calls and respond with locally cached content, if available.\n     * New parameters available on the call to fetch:\n     * localCache   : true // required - either a boolean (if true, localStorage is used,\n     * if false request is not cached or returned from cache), or an object implementing the\n     * Storage interface, in which case that object is used instead.\n     * cacheTTL     : 5, // optional, cache time in hours, default is 5. Use float numbers for\n     * values less than a full hour (e.g. 0.5 for 1/2 hour).\n     * cacheKey     : 'post', // optional - key under which cached string will be stored.\n     * isCacheValid : function  // optional - return true for valid, false for invalid.\n     */\n    self.fetch = function (url, settings) {\n        var storage = getStorage(settings.localCache),\n            hourstl = settings.cacheTTL || 5,\n            cacheKey = genCacheKey(url, settings),\n            cacheValid = settings.isCacheValid,\n            ttl,\n            value,\n            dataType;\n\n        if (!storage) return fetch(url, settings);\n\n        ttl = storage.getItem(cacheKey + 'cachettl');\n\n        if (cacheValid && typeof cacheValid === 'function' && !cacheValid()) {\n            removeFromStorage(storage, cacheKey);\n            ttl = 0;\n        }\n\n        if (ttl && ttl \u003C +new Date()) {\n            removeFromStorage(storage, cacheKey);\n        }\n\n        value = storage.getItem(cacheKey);\n\n        if (!value) {\n            /* If not cached, we'll make the request and add a then block to the resulting promise,\n             in which we'll cache the result. */\n            return fetch(url, settings).then(cacheResponse.bind(null, cacheKey, storage, hourstl));\n        }\n\n        /* Value is cached, so we'll simply create and respond with a promise of our own,\n         and provide a response object. */\n        dataType = storage.getItem(cacheKey + 'dataType') || 'text/plain';\n        return provideResponse(value, dataType);\n    };\n})(self.fetch);\n",[1254],{"type":20,"tag":68,"props":1255,"children":1256},{"__ignoreMap":8},[1257,1265,1273,1281,1289,1297,1305,1313,1337,1345,1353,1385,1392,1400,1408,1416,1424,1441,1449,1484,1560,1577,1584,1650,1658,1665,1672,1680,1688,1696,1703,1724,1741,1749,1774,1809,1845,1899,1935,1949,1957,1989,2002,2010,2018,2026,2035,2043,2064,2085,2093,2126,2145,2173,2201,2209,2217,2225,2234,2243,2252,2260,2284,2293,2317,2326,2350,2359,2379,2387,2435,2463,2516,2524,2565,2578,2595,2667,2695,2712,2721,2734,2763,2771,2780,2788,2800,2808,2816,2824,2833,2842,2850,2866,2882,2898,2906,2938,2966,2975,2984,3001,3018,3027,3040,3049,3057,3066,3074,3118,3131,3139,3147,3155,3163,3172,3181,3190,3204,3213,3222,3236,3245,3259,3273,3281,3324,3349,3380,3402,3420,3429,3437,3446,3454,3488,3496,3535,3543,3598,3610,3632,3640,3648,3688,3700,3708,3716,3741,3749,3770,3779,3788,3833,3841,3849,3858,3867,3915,3932,3941],{"type":20,"tag":194,"props":1258,"children":1259},{"class":196,"line":197},[1260],{"type":20,"tag":194,"props":1261,"children":1262},{"style":201},[1263],{"type":30,"value":1264},"/**\n",{"type":20,"tag":194,"props":1266,"children":1267},{"class":196,"line":207},[1268],{"type":20,"tag":194,"props":1269,"children":1270},{"style":201},[1271],{"type":30,"value":1272}," * Copyright (c) Christopher Keefer, 2016.\n",{"type":20,"tag":194,"props":1274,"children":1275},{"class":196,"line":216},[1276],{"type":20,"tag":194,"props":1277,"children":1278},{"style":201},[1279],{"type":30,"value":1280}," * https://github.com/SaneMethod/fetchCache\n",{"type":20,"tag":194,"props":1282,"children":1283},{"class":196,"line":225},[1284],{"type":20,"tag":194,"props":1285,"children":1286},{"style":201},[1287],{"type":30,"value":1288}," *\n",{"type":20,"tag":194,"props":1290,"children":1291},{"class":196,"line":234},[1292],{"type":20,"tag":194,"props":1293,"children":1294},{"style":201},[1295],{"type":30,"value":1296}," * Override fetch in the global context to allow us to cache the response to fetch in a Storage interface\n",{"type":20,"tag":194,"props":1298,"children":1299},{"class":196,"line":243},[1300],{"type":20,"tag":194,"props":1301,"children":1302},{"style":201},[1303],{"type":30,"value":1304}," * implementing object (such as localStorage).\n",{"type":20,"tag":194,"props":1306,"children":1307},{"class":196,"line":275},[1308],{"type":20,"tag":194,"props":1309,"children":1310},{"style":201},[1311],{"type":30,"value":1312}," */\n",{"type":20,"tag":194,"props":1314,"children":1315},{"class":196,"line":284},[1316,1320,1324,1328,1333],{"type":20,"tag":194,"props":1317,"children":1318},{"style":264},[1319],{"type":30,"value":403},{"type":20,"tag":194,"props":1321,"children":1322},{"style":252},[1323],{"type":30,"value":393},{"type":20,"tag":194,"props":1325,"children":1326},{"style":264},[1327],{"type":30,"value":1172},{"type":20,"tag":194,"props":1329,"children":1330},{"style":406},[1331],{"type":30,"value":1332},"fetch",{"type":20,"tag":194,"props":1334,"children":1335},{"style":264},[1336],{"type":30,"value":442},{"type":20,"tag":194,"props":1338,"children":1339},{"class":196,"line":311},[1340],{"type":20,"tag":194,"props":1341,"children":1342},{"style":201},[1343],{"type":30,"value":1344},"    /* If the context doesn't support fetch, we won't attempt to patch in our\n",{"type":20,"tag":194,"props":1346,"children":1347},{"class":196,"line":320},[1348],{"type":20,"tag":194,"props":1349,"children":1350},{"style":201},[1351],{"type":30,"value":1352},"     caching using fetch, for obvious reasons. */\n",{"type":20,"tag":194,"props":1354,"children":1355},{"class":196,"line":347},[1356,1361,1365,1370,1375,1380],{"type":20,"tag":194,"props":1357,"children":1358},{"style":252},[1359],{"type":30,"value":1360},"    if",{"type":20,"tag":194,"props":1362,"children":1363},{"style":264},[1364],{"type":30,"value":1172},{"type":20,"tag":194,"props":1366,"children":1367},{"style":252},[1368],{"type":30,"value":1369},"!",{"type":20,"tag":194,"props":1371,"children":1372},{"style":264},[1373],{"type":30,"value":1374},"fetch) ",{"type":20,"tag":194,"props":1376,"children":1377},{"style":252},[1378],{"type":30,"value":1379},"return",{"type":20,"tag":194,"props":1381,"children":1382},{"style":264},[1383],{"type":30,"value":1384},";\n",{"type":20,"tag":194,"props":1386,"children":1387},{"class":196,"line":356},[1388],{"type":20,"tag":194,"props":1389,"children":1390},{"emptyLinePlaceholder":546},[1391],{"type":30,"value":549},{"type":20,"tag":194,"props":1393,"children":1394},{"class":196,"line":378},[1395],{"type":20,"tag":194,"props":1396,"children":1397},{"style":201},[1398],{"type":30,"value":1399},"    /**\n",{"type":20,"tag":194,"props":1401,"children":1402},{"class":196,"line":387},[1403],{"type":20,"tag":194,"props":1404,"children":1405},{"style":201},[1406],{"type":30,"value":1407},"     * Generate the cache key under which to store the local data - either the cache key supplied,\n",{"type":20,"tag":194,"props":1409,"children":1410},{"class":196,"line":445},[1411],{"type":20,"tag":194,"props":1412,"children":1413},{"style":201},[1414],{"type":30,"value":1415},"     * or one generated from the url, the Content-type header (if specified) and the body (if specified).\n",{"type":20,"tag":194,"props":1417,"children":1418},{"class":196,"line":479},[1419],{"type":20,"tag":194,"props":1420,"children":1421},{"style":201},[1422],{"type":30,"value":1423},"     *\n",{"type":20,"tag":194,"props":1425,"children":1426},{"class":196,"line":542},[1427,1432,1436],{"type":20,"tag":194,"props":1428,"children":1429},{"style":201},[1430],{"type":30,"value":1431},"     * ",{"type":20,"tag":194,"props":1433,"children":1434},{"style":252},[1435],{"type":30,"value":964},{"type":20,"tag":194,"props":1437,"children":1438},{"style":258},[1439],{"type":30,"value":1440}," {string}\n",{"type":20,"tag":194,"props":1442,"children":1443},{"class":196,"line":552},[1444],{"type":20,"tag":194,"props":1445,"children":1446},{"style":201},[1447],{"type":30,"value":1448},"     */\n",{"type":20,"tag":194,"props":1450,"children":1451},{"class":196,"line":598},[1452,1457,1462,1466,1471,1475,1480],{"type":20,"tag":194,"props":1453,"children":1454},{"style":252},[1455],{"type":30,"value":1456},"    function",{"type":20,"tag":194,"props":1458,"children":1459},{"style":258},[1460],{"type":30,"value":1461}," genCacheKey",{"type":20,"tag":194,"props":1463,"children":1464},{"style":264},[1465],{"type":30,"value":403},{"type":20,"tag":194,"props":1467,"children":1468},{"style":406},[1469],{"type":30,"value":1470},"url",{"type":20,"tag":194,"props":1472,"children":1473},{"style":264},[1474],{"type":30,"value":414},{"type":20,"tag":194,"props":1476,"children":1477},{"style":406},[1478],{"type":30,"value":1479},"settings",{"type":20,"tag":194,"props":1481,"children":1482},{"style":264},[1483],{"type":30,"value":442},{"type":20,"tag":194,"props":1485,"children":1486},{"class":196,"line":611},[1487,1492,1497,1502,1507,1512,1517,1521,1525,1530,1535,1540,1545,1550,1555],{"type":20,"tag":194,"props":1488,"children":1489},{"style":252},[1490],{"type":30,"value":1491},"        var",{"type":20,"tag":194,"props":1493,"children":1494},{"style":264},[1495],{"type":30,"value":1496}," {",{"type":20,"tag":194,"props":1498,"children":1499},{"style":406},[1500],{"type":30,"value":1501},"headers",{"type":20,"tag":194,"props":1503,"children":1504},{"style":264},[1505],{"type":30,"value":1506},":{",{"type":20,"tag":194,"props":1508,"children":1509},{"style":506},[1510],{"type":30,"value":1511},"'Content-type'",{"type":20,"tag":194,"props":1513,"children":1514},{"style":264},[1515],{"type":30,"value":1516},": type}} ",{"type":20,"tag":194,"props":1518,"children":1519},{"style":252},[1520],{"type":30,"value":461},{"type":20,"tag":194,"props":1522,"children":1523},{"style":264},[1524],{"type":30,"value":1172},{"type":20,"tag":194,"props":1526,"children":1527},{"style":506},[1528],{"type":30,"value":1529},"'headers'",{"type":20,"tag":194,"props":1531,"children":1532},{"style":252},[1533],{"type":30,"value":1534}," in",{"type":20,"tag":194,"props":1536,"children":1537},{"style":264},[1538],{"type":30,"value":1539}," settings) ",{"type":20,"tag":194,"props":1541,"children":1542},{"style":252},[1543],{"type":30,"value":1544},"?",{"type":20,"tag":194,"props":1546,"children":1547},{"style":264},[1548],{"type":30,"value":1549}," settings ",{"type":20,"tag":194,"props":1551,"children":1552},{"style":252},[1553],{"type":30,"value":1554},":",{"type":20,"tag":194,"props":1556,"children":1557},{"style":264},[1558],{"type":30,"value":1559}," {headers: {}},\n",{"type":20,"tag":194,"props":1561,"children":1562},{"class":196,"line":630},[1563,1568,1572],{"type":20,"tag":194,"props":1564,"children":1565},{"style":264},[1566],{"type":30,"value":1567},"            {body} ",{"type":20,"tag":194,"props":1569,"children":1570},{"style":252},[1571],{"type":30,"value":461},{"type":20,"tag":194,"props":1573,"children":1574},{"style":264},[1575],{"type":30,"value":1576}," settings;\n",{"type":20,"tag":194,"props":1578,"children":1579},{"class":196,"line":713},[1580],{"type":20,"tag":194,"props":1581,"children":1582},{"emptyLinePlaceholder":546},[1583],{"type":30,"value":549},{"type":20,"tag":194,"props":1585,"children":1586},{"class":196,"line":743},[1587,1592,1597,1601,1606,1610,1615,1619,1624,1628,1632,1637,1641,1645],{"type":20,"tag":194,"props":1588,"children":1589},{"style":252},[1590],{"type":30,"value":1591},"        return",{"type":20,"tag":194,"props":1593,"children":1594},{"style":264},[1595],{"type":30,"value":1596}," settings.cacheKey ",{"type":20,"tag":194,"props":1598,"children":1599},{"style":252},[1600],{"type":30,"value":519},{"type":20,"tag":194,"props":1602,"children":1603},{"style":264},[1604],{"type":30,"value":1605}," url ",{"type":20,"tag":194,"props":1607,"children":1608},{"style":252},[1609],{"type":30,"value":649},{"type":20,"tag":194,"props":1611,"children":1612},{"style":264},[1613],{"type":30,"value":1614}," (type ",{"type":20,"tag":194,"props":1616,"children":1617},{"style":252},[1618],{"type":30,"value":519},{"type":20,"tag":194,"props":1620,"children":1621},{"style":506},[1622],{"type":30,"value":1623}," ''",{"type":20,"tag":194,"props":1625,"children":1626},{"style":264},[1627],{"type":30,"value":514},{"type":20,"tag":194,"props":1629,"children":1630},{"style":252},[1631],{"type":30,"value":649},{"type":20,"tag":194,"props":1633,"children":1634},{"style":264},[1635],{"type":30,"value":1636}," (body ",{"type":20,"tag":194,"props":1638,"children":1639},{"style":252},[1640],{"type":30,"value":519},{"type":20,"tag":194,"props":1642,"children":1643},{"style":506},[1644],{"type":30,"value":1623},{"type":20,"tag":194,"props":1646,"children":1647},{"style":264},[1648],{"type":30,"value":1649},");\n",{"type":20,"tag":194,"props":1651,"children":1652},{"class":196,"line":762},[1653],{"type":20,"tag":194,"props":1654,"children":1655},{"style":264},[1656],{"type":30,"value":1657},"    }\n",{"type":20,"tag":194,"props":1659,"children":1660},{"class":196,"line":771},[1661],{"type":20,"tag":194,"props":1662,"children":1663},{"emptyLinePlaceholder":546},[1664],{"type":30,"value":549},{"type":20,"tag":194,"props":1666,"children":1667},{"class":196,"line":785},[1668],{"type":20,"tag":194,"props":1669,"children":1670},{"style":201},[1671],{"type":30,"value":1399},{"type":20,"tag":194,"props":1673,"children":1674},{"class":196,"line":818},[1675],{"type":20,"tag":194,"props":1676,"children":1677},{"style":201},[1678],{"type":30,"value":1679},"     * Determine whether we're using localStorage or, if the user has specified something other than a boolean\n",{"type":20,"tag":194,"props":1681,"children":1682},{"class":196,"line":827},[1683],{"type":20,"tag":194,"props":1684,"children":1685},{"style":201},[1686],{"type":30,"value":1687},"     * value for options.localCache, whether the value appears to satisfy the plugin's requirements.\n",{"type":20,"tag":194,"props":1689,"children":1690},{"class":196,"line":836},[1691],{"type":20,"tag":194,"props":1692,"children":1693},{"style":201},[1694],{"type":30,"value":1695},"     * Otherwise, throw a new TypeError indicating what type of value we expect.\n",{"type":20,"tag":194,"props":1697,"children":1698},{"class":196,"line":844},[1699],{"type":20,"tag":194,"props":1700,"children":1701},{"style":201},[1702],{"type":30,"value":1423},{"type":20,"tag":194,"props":1704,"children":1705},{"class":196,"line":858},[1706,1710,1714,1719],{"type":20,"tag":194,"props":1707,"children":1708},{"style":201},[1709],{"type":30,"value":1431},{"type":20,"tag":194,"props":1711,"children":1712},{"style":252},[1713],{"type":30,"value":255},{"type":20,"tag":194,"props":1715,"children":1716},{"style":258},[1717],{"type":30,"value":1718}," {boolean|object}",{"type":20,"tag":194,"props":1720,"children":1721},{"style":264},[1722],{"type":30,"value":1723}," storage\n",{"type":20,"tag":194,"props":1725,"children":1727},{"class":196,"line":1726},32,[1728,1732,1736],{"type":20,"tag":194,"props":1729,"children":1730},{"style":201},[1731],{"type":30,"value":1431},{"type":20,"tag":194,"props":1733,"children":1734},{"style":252},[1735],{"type":30,"value":964},{"type":20,"tag":194,"props":1737,"children":1738},{"style":258},[1739],{"type":30,"value":1740}," {boolean|object}\n",{"type":20,"tag":194,"props":1742,"children":1744},{"class":196,"line":1743},33,[1745],{"type":20,"tag":194,"props":1746,"children":1747},{"style":201},[1748],{"type":30,"value":1448},{"type":20,"tag":194,"props":1750,"children":1752},{"class":196,"line":1751},34,[1753,1757,1762,1766,1770],{"type":20,"tag":194,"props":1754,"children":1755},{"style":252},[1756],{"type":30,"value":1456},{"type":20,"tag":194,"props":1758,"children":1759},{"style":258},[1760],{"type":30,"value":1761}," getStorage",{"type":20,"tag":194,"props":1763,"children":1764},{"style":264},[1765],{"type":30,"value":403},{"type":20,"tag":194,"props":1767,"children":1768},{"style":406},[1769],{"type":30,"value":419},{"type":20,"tag":194,"props":1771,"children":1772},{"style":264},[1773],{"type":30,"value":442},{"type":20,"tag":194,"props":1775,"children":1777},{"class":196,"line":1776},35,[1778,1783,1787,1791,1796,1800,1805],{"type":20,"tag":194,"props":1779,"children":1780},{"style":252},[1781],{"type":30,"value":1782},"        if",{"type":20,"tag":194,"props":1784,"children":1785},{"style":264},[1786],{"type":30,"value":1172},{"type":20,"tag":194,"props":1788,"children":1789},{"style":252},[1790],{"type":30,"value":1369},{"type":20,"tag":194,"props":1792,"children":1793},{"style":264},[1794],{"type":30,"value":1795},"storage) ",{"type":20,"tag":194,"props":1797,"children":1798},{"style":252},[1799],{"type":30,"value":1379},{"type":20,"tag":194,"props":1801,"children":1802},{"style":680},[1803],{"type":30,"value":1804}," false",{"type":20,"tag":194,"props":1806,"children":1807},{"style":264},[1808],{"type":30,"value":1384},{"type":20,"tag":194,"props":1810,"children":1812},{"class":196,"line":1811},36,[1813,1817,1822,1827,1832,1836,1840],{"type":20,"tag":194,"props":1814,"children":1815},{"style":252},[1816],{"type":30,"value":1782},{"type":20,"tag":194,"props":1818,"children":1819},{"style":264},[1820],{"type":30,"value":1821}," (storage ",{"type":20,"tag":194,"props":1823,"children":1824},{"style":252},[1825],{"type":30,"value":1826},"===",{"type":20,"tag":194,"props":1828,"children":1829},{"style":680},[1830],{"type":30,"value":1831}," true",{"type":20,"tag":194,"props":1833,"children":1834},{"style":264},[1835],{"type":30,"value":514},{"type":20,"tag":194,"props":1837,"children":1838},{"style":252},[1839],{"type":30,"value":1379},{"type":20,"tag":194,"props":1841,"children":1842},{"style":264},[1843],{"type":30,"value":1844}," self.localStorage;\n",{"type":20,"tag":194,"props":1846,"children":1848},{"class":196,"line":1847},37,[1849,1853,1857,1862,1867,1871,1876,1881,1886,1890,1894],{"type":20,"tag":194,"props":1850,"children":1851},{"style":252},[1852],{"type":30,"value":1782},{"type":20,"tag":194,"props":1854,"children":1855},{"style":264},[1856],{"type":30,"value":1172},{"type":20,"tag":194,"props":1858,"children":1859},{"style":252},[1860],{"type":30,"value":1861},"typeof",{"type":20,"tag":194,"props":1863,"children":1864},{"style":264},[1865],{"type":30,"value":1866}," storage ",{"type":20,"tag":194,"props":1868,"children":1869},{"style":252},[1870],{"type":30,"value":1826},{"type":20,"tag":194,"props":1872,"children":1873},{"style":506},[1874],{"type":30,"value":1875}," \"object\"",{"type":20,"tag":194,"props":1877,"children":1878},{"style":252},[1879],{"type":30,"value":1880}," &&",{"type":20,"tag":194,"props":1882,"children":1883},{"style":506},[1884],{"type":30,"value":1885}," 'getItem'",{"type":20,"tag":194,"props":1887,"children":1888},{"style":252},[1889],{"type":30,"value":1534},{"type":20,"tag":194,"props":1891,"children":1892},{"style":264},[1893],{"type":30,"value":1866},{"type":20,"tag":194,"props":1895,"children":1896},{"style":252},[1897],{"type":30,"value":1898},"&&\n",{"type":20,"tag":194,"props":1900,"children":1902},{"class":196,"line":1901},38,[1903,1908,1912,1916,1921,1926,1930],{"type":20,"tag":194,"props":1904,"children":1905},{"style":506},[1906],{"type":30,"value":1907},"            'removeItem'",{"type":20,"tag":194,"props":1909,"children":1910},{"style":252},[1911],{"type":30,"value":1534},{"type":20,"tag":194,"props":1913,"children":1914},{"style":264},[1915],{"type":30,"value":1866},{"type":20,"tag":194,"props":1917,"children":1918},{"style":252},[1919],{"type":30,"value":1920},"&&",{"type":20,"tag":194,"props":1922,"children":1923},{"style":506},[1924],{"type":30,"value":1925}," 'setItem'",{"type":20,"tag":194,"props":1927,"children":1928},{"style":252},[1929],{"type":30,"value":1534},{"type":20,"tag":194,"props":1931,"children":1932},{"style":264},[1933],{"type":30,"value":1934}," storage) {\n",{"type":20,"tag":194,"props":1936,"children":1938},{"class":196,"line":1937},39,[1939,1944],{"type":20,"tag":194,"props":1940,"children":1941},{"style":252},[1942],{"type":30,"value":1943},"            return",{"type":20,"tag":194,"props":1945,"children":1946},{"style":264},[1947],{"type":30,"value":1948}," storage;\n",{"type":20,"tag":194,"props":1950,"children":1952},{"class":196,"line":1951},40,[1953],{"type":20,"tag":194,"props":1954,"children":1955},{"style":264},[1956],{"type":30,"value":824},{"type":20,"tag":194,"props":1958,"children":1960},{"class":196,"line":1959},41,[1961,1966,1970,1975,1979,1984],{"type":20,"tag":194,"props":1962,"children":1963},{"style":252},[1964],{"type":30,"value":1965},"        throw",{"type":20,"tag":194,"props":1967,"children":1968},{"style":252},[1969],{"type":30,"value":1031},{"type":20,"tag":194,"props":1971,"children":1972},{"style":258},[1973],{"type":30,"value":1974}," TypeError",{"type":20,"tag":194,"props":1976,"children":1977},{"style":264},[1978],{"type":30,"value":403},{"type":20,"tag":194,"props":1980,"children":1981},{"style":506},[1982],{"type":30,"value":1983},"\"localCache must either be a boolean value, \"",{"type":20,"tag":194,"props":1985,"children":1986},{"style":252},[1987],{"type":30,"value":1988}," +\n",{"type":20,"tag":194,"props":1990,"children":1992},{"class":196,"line":1991},42,[1993,1998],{"type":20,"tag":194,"props":1994,"children":1995},{"style":506},[1996],{"type":30,"value":1997},"            \"or an object which implements the Storage interface.\"",{"type":20,"tag":194,"props":1999,"children":2000},{"style":264},[2001],{"type":30,"value":1649},{"type":20,"tag":194,"props":2003,"children":2005},{"class":196,"line":2004},43,[2006],{"type":20,"tag":194,"props":2007,"children":2008},{"style":264},[2009],{"type":30,"value":1657},{"type":20,"tag":194,"props":2011,"children":2013},{"class":196,"line":2012},44,[2014],{"type":20,"tag":194,"props":2015,"children":2016},{"emptyLinePlaceholder":546},[2017],{"type":30,"value":549},{"type":20,"tag":194,"props":2019,"children":2021},{"class":196,"line":2020},45,[2022],{"type":20,"tag":194,"props":2023,"children":2024},{"style":201},[2025],{"type":30,"value":1399},{"type":20,"tag":194,"props":2027,"children":2029},{"class":196,"line":2028},46,[2030],{"type":20,"tag":194,"props":2031,"children":2032},{"style":201},[2033],{"type":30,"value":2034},"     * Remove the item specified by cacheKey and its attendant meta items from storage.\n",{"type":20,"tag":194,"props":2036,"children":2038},{"class":196,"line":2037},47,[2039],{"type":20,"tag":194,"props":2040,"children":2041},{"style":201},[2042],{"type":30,"value":1423},{"type":20,"tag":194,"props":2044,"children":2046},{"class":196,"line":2045},48,[2047,2051,2055,2060],{"type":20,"tag":194,"props":2048,"children":2049},{"style":201},[2050],{"type":30,"value":1431},{"type":20,"tag":194,"props":2052,"children":2053},{"style":252},[2054],{"type":30,"value":255},{"type":20,"tag":194,"props":2056,"children":2057},{"style":258},[2058],{"type":30,"value":2059}," {Storage|object}",{"type":20,"tag":194,"props":2061,"children":2062},{"style":264},[2063],{"type":30,"value":1723},{"type":20,"tag":194,"props":2065,"children":2067},{"class":196,"line":2066},49,[2068,2072,2076,2080],{"type":20,"tag":194,"props":2069,"children":2070},{"style":201},[2071],{"type":30,"value":1431},{"type":20,"tag":194,"props":2073,"children":2074},{"style":252},[2075],{"type":30,"value":255},{"type":20,"tag":194,"props":2077,"children":2078},{"style":258},[2079],{"type":30,"value":261},{"type":20,"tag":194,"props":2081,"children":2082},{"style":264},[2083],{"type":30,"value":2084}," cacheKey\n",{"type":20,"tag":194,"props":2086,"children":2088},{"class":196,"line":2087},50,[2089],{"type":20,"tag":194,"props":2090,"children":2091},{"style":201},[2092],{"type":30,"value":1448},{"type":20,"tag":194,"props":2094,"children":2096},{"class":196,"line":2095},51,[2097,2101,2106,2110,2114,2118,2122],{"type":20,"tag":194,"props":2098,"children":2099},{"style":252},[2100],{"type":30,"value":1456},{"type":20,"tag":194,"props":2102,"children":2103},{"style":258},[2104],{"type":30,"value":2105}," removeFromStorage",{"type":20,"tag":194,"props":2107,"children":2108},{"style":264},[2109],{"type":30,"value":403},{"type":20,"tag":194,"props":2111,"children":2112},{"style":406},[2113],{"type":30,"value":419},{"type":20,"tag":194,"props":2115,"children":2116},{"style":264},[2117],{"type":30,"value":414},{"type":20,"tag":194,"props":2119,"children":2120},{"style":406},[2121],{"type":30,"value":409},{"type":20,"tag":194,"props":2123,"children":2124},{"style":264},[2125],{"type":30,"value":442},{"type":20,"tag":194,"props":2127,"children":2129},{"class":196,"line":2128},52,[2130,2135,2140],{"type":20,"tag":194,"props":2131,"children":2132},{"style":264},[2133],{"type":30,"value":2134},"        storage.",{"type":20,"tag":194,"props":2136,"children":2137},{"style":258},[2138],{"type":30,"value":2139},"removeItem",{"type":20,"tag":194,"props":2141,"children":2142},{"style":264},[2143],{"type":30,"value":2144},"(cacheKey);\n",{"type":20,"tag":194,"props":2146,"children":2148},{"class":196,"line":2147},53,[2149,2153,2157,2161,2165,2169],{"type":20,"tag":194,"props":2150,"children":2151},{"style":264},[2152],{"type":30,"value":2134},{"type":20,"tag":194,"props":2154,"children":2155},{"style":258},[2156],{"type":30,"value":2139},{"type":20,"tag":194,"props":2158,"children":2159},{"style":264},[2160],{"type":30,"value":644},{"type":20,"tag":194,"props":2162,"children":2163},{"style":252},[2164],{"type":30,"value":649},{"type":20,"tag":194,"props":2166,"children":2167},{"style":506},[2168],{"type":30,"value":654},{"type":20,"tag":194,"props":2170,"children":2171},{"style":264},[2172],{"type":30,"value":1649},{"type":20,"tag":194,"props":2174,"children":2176},{"class":196,"line":2175},54,[2177,2181,2185,2189,2193,2197],{"type":20,"tag":194,"props":2178,"children":2179},{"style":264},[2180],{"type":30,"value":2134},{"type":20,"tag":194,"props":2182,"children":2183},{"style":258},[2184],{"type":30,"value":2139},{"type":20,"tag":194,"props":2186,"children":2187},{"style":264},[2188],{"type":30,"value":644},{"type":20,"tag":194,"props":2190,"children":2191},{"style":252},[2192],{"type":30,"value":649},{"type":20,"tag":194,"props":2194,"children":2195},{"style":506},[2196],{"type":30,"value":735},{"type":20,"tag":194,"props":2198,"children":2199},{"style":264},[2200],{"type":30,"value":1649},{"type":20,"tag":194,"props":2202,"children":2204},{"class":196,"line":2203},55,[2205],{"type":20,"tag":194,"props":2206,"children":2207},{"style":264},[2208],{"type":30,"value":1657},{"type":20,"tag":194,"props":2210,"children":2212},{"class":196,"line":2211},56,[2213],{"type":20,"tag":194,"props":2214,"children":2215},{"emptyLinePlaceholder":546},[2216],{"type":30,"value":549},{"type":20,"tag":194,"props":2218,"children":2220},{"class":196,"line":2219},57,[2221],{"type":20,"tag":194,"props":2222,"children":2223},{"style":201},[2224],{"type":30,"value":1399},{"type":20,"tag":194,"props":2226,"children":2228},{"class":196,"line":2227},58,[2229],{"type":20,"tag":194,"props":2230,"children":2231},{"style":201},[2232],{"type":30,"value":2233},"     * Cache the response into our storage object.\n",{"type":20,"tag":194,"props":2235,"children":2237},{"class":196,"line":2236},59,[2238],{"type":20,"tag":194,"props":2239,"children":2240},{"style":201},[2241],{"type":30,"value":2242},"     * We clone the response so that we can drain the stream without making it\n",{"type":20,"tag":194,"props":2244,"children":2246},{"class":196,"line":2245},60,[2247],{"type":20,"tag":194,"props":2248,"children":2249},{"style":201},[2250],{"type":30,"value":2251},"     * unavailable to future handlers.\n",{"type":20,"tag":194,"props":2253,"children":2255},{"class":196,"line":2254},61,[2256],{"type":20,"tag":194,"props":2257,"children":2258},{"style":201},[2259],{"type":30,"value":1423},{"type":20,"tag":194,"props":2261,"children":2263},{"class":196,"line":2262},62,[2264,2268,2272,2276,2280],{"type":20,"tag":194,"props":2265,"children":2266},{"style":201},[2267],{"type":30,"value":1431},{"type":20,"tag":194,"props":2269,"children":2270},{"style":252},[2271],{"type":30,"value":255},{"type":20,"tag":194,"props":2273,"children":2274},{"style":258},[2275],{"type":30,"value":261},{"type":20,"tag":194,"props":2277,"children":2278},{"style":264},[2279],{"type":30,"value":267},{"type":20,"tag":194,"props":2281,"children":2282},{"style":201},[2283],{"type":30,"value":272},{"type":20,"tag":194,"props":2285,"children":2287},{"class":196,"line":2286},63,[2288],{"type":20,"tag":194,"props":2289,"children":2290},{"style":201},[2291],{"type":30,"value":2292},"     * fetch override.\n",{"type":20,"tag":194,"props":2294,"children":2296},{"class":196,"line":2295},64,[2297,2301,2305,2309,2313],{"type":20,"tag":194,"props":2298,"children":2299},{"style":201},[2300],{"type":30,"value":1431},{"type":20,"tag":194,"props":2302,"children":2303},{"style":252},[2304],{"type":30,"value":255},{"type":20,"tag":194,"props":2306,"children":2307},{"style":258},[2308],{"type":30,"value":298},{"type":20,"tag":194,"props":2310,"children":2311},{"style":264},[2312],{"type":30,"value":303},{"type":20,"tag":194,"props":2314,"children":2315},{"style":201},[2316],{"type":30,"value":308},{"type":20,"tag":194,"props":2318,"children":2320},{"class":196,"line":2319},65,[2321],{"type":20,"tag":194,"props":2322,"children":2323},{"style":201},[2324],{"type":30,"value":2325},"     * (text or json exclusively) in. Bound in fetch override.\n",{"type":20,"tag":194,"props":2327,"children":2329},{"class":196,"line":2328},66,[2330,2334,2338,2342,2346],{"type":20,"tag":194,"props":2331,"children":2332},{"style":201},[2333],{"type":30,"value":1431},{"type":20,"tag":194,"props":2335,"children":2336},{"style":252},[2337],{"type":30,"value":255},{"type":20,"tag":194,"props":2339,"children":2340},{"style":258},[2341],{"type":30,"value":334},{"type":20,"tag":194,"props":2343,"children":2344},{"style":264},[2345],{"type":30,"value":339},{"type":20,"tag":194,"props":2347,"children":2348},{"style":201},[2349],{"type":30,"value":344},{"type":20,"tag":194,"props":2351,"children":2353},{"class":196,"line":2352},67,[2354],{"type":20,"tag":194,"props":2355,"children":2356},{"style":201},[2357],{"type":30,"value":2358},"     * Bound in fetch override.\n",{"type":20,"tag":194,"props":2360,"children":2362},{"class":196,"line":2361},68,[2363,2367,2371,2375],{"type":20,"tag":194,"props":2364,"children":2365},{"style":201},[2366],{"type":30,"value":1431},{"type":20,"tag":194,"props":2368,"children":2369},{"style":252},[2370],{"type":30,"value":255},{"type":20,"tag":194,"props":2372,"children":2373},{"style":258},[2374],{"type":30,"value":370},{"type":20,"tag":194,"props":2376,"children":2377},{"style":264},[2378],{"type":30,"value":375},{"type":20,"tag":194,"props":2380,"children":2382},{"class":196,"line":2381},69,[2383],{"type":20,"tag":194,"props":2384,"children":2385},{"style":201},[2386],{"type":30,"value":1448},{"type":20,"tag":194,"props":2388,"children":2390},{"class":196,"line":2389},70,[2391,2395,2399,2403,2407,2411,2415,2419,2423,2427,2431],{"type":20,"tag":194,"props":2392,"children":2393},{"style":252},[2394],{"type":30,"value":1456},{"type":20,"tag":194,"props":2396,"children":2397},{"style":258},[2398],{"type":30,"value":398},{"type":20,"tag":194,"props":2400,"children":2401},{"style":264},[2402],{"type":30,"value":403},{"type":20,"tag":194,"props":2404,"children":2405},{"style":406},[2406],{"type":30,"value":409},{"type":20,"tag":194,"props":2408,"children":2409},{"style":264},[2410],{"type":30,"value":414},{"type":20,"tag":194,"props":2412,"children":2413},{"style":406},[2414],{"type":30,"value":419},{"type":20,"tag":194,"props":2416,"children":2417},{"style":264},[2418],{"type":30,"value":414},{"type":20,"tag":194,"props":2420,"children":2421},{"style":406},[2422],{"type":30,"value":428},{"type":20,"tag":194,"props":2424,"children":2425},{"style":264},[2426],{"type":30,"value":414},{"type":20,"tag":194,"props":2428,"children":2429},{"style":406},[2430],{"type":30,"value":437},{"type":20,"tag":194,"props":2432,"children":2433},{"style":264},[2434],{"type":30,"value":442},{"type":20,"tag":194,"props":2436,"children":2438},{"class":196,"line":2437},71,[2439,2443,2447,2451,2455,2459],{"type":20,"tag":194,"props":2440,"children":2441},{"style":252},[2442],{"type":30,"value":1491},{"type":20,"tag":194,"props":2444,"children":2445},{"style":264},[2446],{"type":30,"value":456},{"type":20,"tag":194,"props":2448,"children":2449},{"style":252},[2450],{"type":30,"value":461},{"type":20,"tag":194,"props":2452,"children":2453},{"style":264},[2454],{"type":30,"value":466},{"type":20,"tag":194,"props":2456,"children":2457},{"style":258},[2458],{"type":30,"value":471},{"type":20,"tag":194,"props":2460,"children":2461},{"style":264},[2462],{"type":30,"value":476},{"type":20,"tag":194,"props":2464,"children":2466},{"class":196,"line":2465},72,[2467,2472,2476,2480,2484,2488,2492,2496,2500,2504,2508,2512],{"type":20,"tag":194,"props":2468,"children":2469},{"style":264},[2470],{"type":30,"value":2471},"            dataType ",{"type":20,"tag":194,"props":2473,"children":2474},{"style":252},[2475],{"type":30,"value":461},{"type":20,"tag":194,"props":2477,"children":2478},{"style":264},[2479],{"type":30,"value":494},{"type":20,"tag":194,"props":2481,"children":2482},{"style":258},[2483],{"type":30,"value":499},{"type":20,"tag":194,"props":2485,"children":2486},{"style":264},[2487],{"type":30,"value":403},{"type":20,"tag":194,"props":2489,"children":2490},{"style":506},[2491],{"type":30,"value":509},{"type":20,"tag":194,"props":2493,"children":2494},{"style":264},[2495],{"type":30,"value":514},{"type":20,"tag":194,"props":2497,"children":2498},{"style":252},[2499],{"type":30,"value":519},{"type":20,"tag":194,"props":2501,"children":2502},{"style":506},[2503],{"type":30,"value":524},{"type":20,"tag":194,"props":2505,"children":2506},{"style":264},[2507],{"type":30,"value":529},{"type":20,"tag":194,"props":2509,"children":2510},{"style":258},[2511],{"type":30,"value":534},{"type":20,"tag":194,"props":2513,"children":2514},{"style":264},[2515],{"type":30,"value":539},{"type":20,"tag":194,"props":2517,"children":2519},{"class":196,"line":2518},73,[2520],{"type":20,"tag":194,"props":2521,"children":2522},{"emptyLinePlaceholder":546},[2523],{"type":30,"value":549},{"type":20,"tag":194,"props":2525,"children":2527},{"class":196,"line":2526},74,[2528,2533,2537,2541,2545,2549,2553,2557,2561],{"type":20,"tag":194,"props":2529,"children":2530},{"style":264},[2531],{"type":30,"value":2532},"        cres.",{"type":20,"tag":194,"props":2534,"children":2535},{"style":258},[2536],{"type":30,"value":30},{"type":20,"tag":194,"props":2538,"children":2539},{"style":264},[2540],{"type":30,"value":567},{"type":20,"tag":194,"props":2542,"children":2543},{"style":258},[2544],{"type":30,"value":572},{"type":20,"tag":194,"props":2546,"children":2547},{"style":264},[2548],{"type":30,"value":577},{"type":20,"tag":194,"props":2550,"children":2551},{"style":406},[2552],{"type":30,"value":30},{"type":20,"tag":194,"props":2554,"children":2555},{"style":264},[2556],{"type":30,"value":514},{"type":20,"tag":194,"props":2558,"children":2559},{"style":252},[2560],{"type":30,"value":590},{"type":20,"tag":194,"props":2562,"children":2563},{"style":264},[2564],{"type":30,"value":595},{"type":20,"tag":194,"props":2566,"children":2568},{"class":196,"line":2567},75,[2569,2574],{"type":20,"tag":194,"props":2570,"children":2571},{"style":252},[2572],{"type":30,"value":2573},"            try",{"type":20,"tag":194,"props":2575,"children":2576},{"style":264},[2577],{"type":30,"value":595},{"type":20,"tag":194,"props":2579,"children":2581},{"class":196,"line":2580},76,[2582,2587,2591],{"type":20,"tag":194,"props":2583,"children":2584},{"style":264},[2585],{"type":30,"value":2586},"                storage.",{"type":20,"tag":194,"props":2588,"children":2589},{"style":258},[2590],{"type":30,"value":622},{"type":20,"tag":194,"props":2592,"children":2593},{"style":264},[2594],{"type":30,"value":627},{"type":20,"tag":194,"props":2596,"children":2598},{"class":196,"line":2597},77,[2599,2603,2607,2611,2615,2619,2623,2627,2631,2635,2639,2643,2647,2651,2655,2659,2663],{"type":20,"tag":194,"props":2600,"children":2601},{"style":264},[2602],{"type":30,"value":2586},{"type":20,"tag":194,"props":2604,"children":2605},{"style":258},[2606],{"type":30,"value":622},{"type":20,"tag":194,"props":2608,"children":2609},{"style":264},[2610],{"type":30,"value":644},{"type":20,"tag":194,"props":2612,"children":2613},{"style":252},[2614],{"type":30,"value":649},{"type":20,"tag":194,"props":2616,"children":2617},{"style":506},[2618],{"type":30,"value":654},{"type":20,"tag":194,"props":2620,"children":2621},{"style":264},[2622],{"type":30,"value":414},{"type":20,"tag":194,"props":2624,"children":2625},{"style":252},[2626],{"type":30,"value":663},{"type":20,"tag":194,"props":2628,"children":2629},{"style":258},[2630],{"type":30,"value":668},{"type":20,"tag":194,"props":2632,"children":2633},{"style":264},[2634],{"type":30,"value":673},{"type":20,"tag":194,"props":2636,"children":2637},{"style":252},[2638],{"type":30,"value":649},{"type":20,"tag":194,"props":2640,"children":2641},{"style":680},[2642],{"type":30,"value":683},{"type":20,"tag":194,"props":2644,"children":2645},{"style":252},[2646],{"type":30,"value":688},{"type":20,"tag":194,"props":2648,"children":2649},{"style":680},[2650],{"type":30,"value":693},{"type":20,"tag":194,"props":2652,"children":2653},{"style":252},[2654],{"type":30,"value":688},{"type":20,"tag":194,"props":2656,"children":2657},{"style":680},[2658],{"type":30,"value":693},{"type":20,"tag":194,"props":2660,"children":2661},{"style":252},[2662],{"type":30,"value":688},{"type":20,"tag":194,"props":2664,"children":2665},{"style":264},[2666],{"type":30,"value":710},{"type":20,"tag":194,"props":2668,"children":2670},{"class":196,"line":2669},78,[2671,2675,2679,2683,2687,2691],{"type":20,"tag":194,"props":2672,"children":2673},{"style":264},[2674],{"type":30,"value":2586},{"type":20,"tag":194,"props":2676,"children":2677},{"style":258},[2678],{"type":30,"value":622},{"type":20,"tag":194,"props":2680,"children":2681},{"style":264},[2682],{"type":30,"value":644},{"type":20,"tag":194,"props":2684,"children":2685},{"style":252},[2686],{"type":30,"value":649},{"type":20,"tag":194,"props":2688,"children":2689},{"style":506},[2690],{"type":30,"value":735},{"type":20,"tag":194,"props":2692,"children":2693},{"style":264},[2694],{"type":30,"value":740},{"type":20,"tag":194,"props":2696,"children":2698},{"class":196,"line":2697},79,[2699,2704,2708],{"type":20,"tag":194,"props":2700,"children":2701},{"style":264},[2702],{"type":30,"value":2703},"            } ",{"type":20,"tag":194,"props":2705,"children":2706},{"style":252},[2707],{"type":30,"value":754},{"type":20,"tag":194,"props":2709,"children":2710},{"style":264},[2711],{"type":30,"value":759},{"type":20,"tag":194,"props":2713,"children":2715},{"class":196,"line":2714},80,[2716],{"type":20,"tag":194,"props":2717,"children":2718},{"style":201},[2719],{"type":30,"value":2720},"                // Remove any incomplete data that may have been saved before the exception was caught\n",{"type":20,"tag":194,"props":2722,"children":2724},{"class":196,"line":2723},81,[2725,2730],{"type":20,"tag":194,"props":2726,"children":2727},{"style":258},[2728],{"type":30,"value":2729},"                removeFromStorage",{"type":20,"tag":194,"props":2731,"children":2732},{"style":264},[2733],{"type":30,"value":782},{"type":20,"tag":194,"props":2735,"children":2737},{"class":196,"line":2736},82,[2738,2743,2747,2751,2755,2759],{"type":20,"tag":194,"props":2739,"children":2740},{"style":264},[2741],{"type":30,"value":2742},"                console.",{"type":20,"tag":194,"props":2744,"children":2745},{"style":258},[2746],{"type":30,"value":796},{"type":20,"tag":194,"props":2748,"children":2749},{"style":264},[2750],{"type":30,"value":403},{"type":20,"tag":194,"props":2752,"children":2753},{"style":506},[2754],{"type":30,"value":805},{"type":20,"tag":194,"props":2756,"children":2757},{"style":252},[2758],{"type":30,"value":810},{"type":20,"tag":194,"props":2760,"children":2761},{"style":264},[2762],{"type":30,"value":815},{"type":20,"tag":194,"props":2764,"children":2766},{"class":196,"line":2765},83,[2767],{"type":20,"tag":194,"props":2768,"children":2769},{"style":264},[2770],{"type":30,"value":1121},{"type":20,"tag":194,"props":2772,"children":2774},{"class":196,"line":2773},84,[2775],{"type":20,"tag":194,"props":2776,"children":2777},{"style":264},[2778],{"type":30,"value":2779},"        });\n",{"type":20,"tag":194,"props":2781,"children":2783},{"class":196,"line":2782},85,[2784],{"type":20,"tag":194,"props":2785,"children":2786},{"emptyLinePlaceholder":546},[2787],{"type":30,"value":549},{"type":20,"tag":194,"props":2789,"children":2791},{"class":196,"line":2790},86,[2792,2796],{"type":20,"tag":194,"props":2793,"children":2794},{"style":252},[2795],{"type":30,"value":1591},{"type":20,"tag":194,"props":2797,"children":2798},{"style":264},[2799],{"type":30,"value":855},{"type":20,"tag":194,"props":2801,"children":2803},{"class":196,"line":2802},87,[2804],{"type":20,"tag":194,"props":2805,"children":2806},{"style":264},[2807],{"type":30,"value":1657},{"type":20,"tag":194,"props":2809,"children":2811},{"class":196,"line":2810},88,[2812],{"type":20,"tag":194,"props":2813,"children":2814},{"emptyLinePlaceholder":546},[2815],{"type":30,"value":549},{"type":20,"tag":194,"props":2817,"children":2819},{"class":196,"line":2818},89,[2820],{"type":20,"tag":194,"props":2821,"children":2822},{"style":201},[2823],{"type":30,"value":1399},{"type":20,"tag":194,"props":2825,"children":2827},{"class":196,"line":2826},90,[2828],{"type":20,"tag":194,"props":2829,"children":2830},{"style":201},[2831],{"type":30,"value":2832},"     * Create a new response containing the cached value, and return a promise\n",{"type":20,"tag":194,"props":2834,"children":2836},{"class":196,"line":2835},91,[2837],{"type":20,"tag":194,"props":2838,"children":2839},{"style":201},[2840],{"type":30,"value":2841},"     * that resolves with this response.\n",{"type":20,"tag":194,"props":2843,"children":2845},{"class":196,"line":2844},92,[2846],{"type":20,"tag":194,"props":2847,"children":2848},{"style":201},[2849],{"type":30,"value":1423},{"type":20,"tag":194,"props":2851,"children":2853},{"class":196,"line":2852},93,[2854,2858,2862],{"type":20,"tag":194,"props":2855,"children":2856},{"style":201},[2857],{"type":30,"value":1431},{"type":20,"tag":194,"props":2859,"children":2860},{"style":252},[2861],{"type":30,"value":255},{"type":20,"tag":194,"props":2863,"children":2864},{"style":264},[2865],{"type":30,"value":936},{"type":20,"tag":194,"props":2867,"children":2869},{"class":196,"line":2868},94,[2870,2874,2878],{"type":20,"tag":194,"props":2871,"children":2872},{"style":201},[2873],{"type":30,"value":1431},{"type":20,"tag":194,"props":2875,"children":2876},{"style":252},[2877],{"type":30,"value":255},{"type":20,"tag":194,"props":2879,"children":2880},{"style":264},[2881],{"type":30,"value":952},{"type":20,"tag":194,"props":2883,"children":2885},{"class":196,"line":2884},95,[2886,2890,2894],{"type":20,"tag":194,"props":2887,"children":2888},{"style":201},[2889],{"type":30,"value":1431},{"type":20,"tag":194,"props":2891,"children":2892},{"style":252},[2893],{"type":30,"value":964},{"type":20,"tag":194,"props":2895,"children":2896},{"style":258},[2897],{"type":30,"value":969},{"type":20,"tag":194,"props":2899,"children":2901},{"class":196,"line":2900},96,[2902],{"type":20,"tag":194,"props":2903,"children":2904},{"style":201},[2905],{"type":30,"value":1448},{"type":20,"tag":194,"props":2907,"children":2909},{"class":196,"line":2908},97,[2910,2914,2918,2922,2926,2930,2934],{"type":20,"tag":194,"props":2911,"children":2912},{"style":252},[2913],{"type":30,"value":1456},{"type":20,"tag":194,"props":2915,"children":2916},{"style":258},[2917],{"type":30,"value":988},{"type":20,"tag":194,"props":2919,"children":2920},{"style":264},[2921],{"type":30,"value":403},{"type":20,"tag":194,"props":2923,"children":2924},{"style":406},[2925],{"type":30,"value":997},{"type":20,"tag":194,"props":2927,"children":2928},{"style":264},[2929],{"type":30,"value":414},{"type":20,"tag":194,"props":2931,"children":2932},{"style":406},[2933],{"type":30,"value":1006},{"type":20,"tag":194,"props":2935,"children":2936},{"style":264},[2937],{"type":30,"value":442},{"type":20,"tag":194,"props":2939,"children":2941},{"class":196,"line":2940},98,[2942,2946,2950,2954,2958,2962],{"type":20,"tag":194,"props":2943,"children":2944},{"style":252},[2945],{"type":30,"value":1491},{"type":20,"tag":194,"props":2947,"children":2948},{"style":264},[2949],{"type":30,"value":1022},{"type":20,"tag":194,"props":2951,"children":2952},{"style":252},[2953],{"type":30,"value":461},{"type":20,"tag":194,"props":2955,"children":2956},{"style":252},[2957],{"type":30,"value":1031},{"type":20,"tag":194,"props":2959,"children":2960},{"style":258},[2961],{"type":30,"value":1036},{"type":20,"tag":194,"props":2963,"children":2964},{"style":264},[2965],{"type":30,"value":1041},{"type":20,"tag":194,"props":2967,"children":2969},{"class":196,"line":2968},99,[2970],{"type":20,"tag":194,"props":2971,"children":2972},{"style":264},[2973],{"type":30,"value":2974},"            value,\n",{"type":20,"tag":194,"props":2976,"children":2978},{"class":196,"line":2977},100,[2979],{"type":20,"tag":194,"props":2980,"children":2981},{"style":264},[2982],{"type":30,"value":2983},"            {\n",{"type":20,"tag":194,"props":2985,"children":2987},{"class":196,"line":2986},101,[2988,2993,2997],{"type":20,"tag":194,"props":2989,"children":2990},{"style":264},[2991],{"type":30,"value":2992},"                status: ",{"type":20,"tag":194,"props":2994,"children":2995},{"style":680},[2996],{"type":30,"value":1070},{"type":20,"tag":194,"props":2998,"children":2999},{"style":264},[3000],{"type":30,"value":1075},{"type":20,"tag":194,"props":3002,"children":3004},{"class":196,"line":3003},102,[3005,3010,3014],{"type":20,"tag":194,"props":3006,"children":3007},{"style":264},[3008],{"type":30,"value":3009},"                statusText: ",{"type":20,"tag":194,"props":3011,"children":3012},{"style":506},[3013],{"type":30,"value":1088},{"type":20,"tag":194,"props":3015,"children":3016},{"style":264},[3017],{"type":30,"value":1075},{"type":20,"tag":194,"props":3019,"children":3021},{"class":196,"line":3020},103,[3022],{"type":20,"tag":194,"props":3023,"children":3024},{"style":264},[3025],{"type":30,"value":3026},"                headers: {\n",{"type":20,"tag":194,"props":3028,"children":3030},{"class":196,"line":3029},104,[3031,3036],{"type":20,"tag":194,"props":3032,"children":3033},{"style":506},[3034],{"type":30,"value":3035},"                    'Content-Type'",{"type":20,"tag":194,"props":3037,"children":3038},{"style":264},[3039],{"type":30,"value":1113},{"type":20,"tag":194,"props":3041,"children":3043},{"class":196,"line":3042},105,[3044],{"type":20,"tag":194,"props":3045,"children":3046},{"style":264},[3047],{"type":30,"value":3048},"                }\n",{"type":20,"tag":194,"props":3050,"children":3052},{"class":196,"line":3051},106,[3053],{"type":20,"tag":194,"props":3054,"children":3055},{"style":264},[3056],{"type":30,"value":1121},{"type":20,"tag":194,"props":3058,"children":3060},{"class":196,"line":3059},107,[3061],{"type":20,"tag":194,"props":3062,"children":3063},{"style":264},[3064],{"type":30,"value":3065},"        );\n",{"type":20,"tag":194,"props":3067,"children":3069},{"class":196,"line":3068},108,[3070],{"type":20,"tag":194,"props":3071,"children":3072},{"emptyLinePlaceholder":546},[3073],{"type":30,"value":549},{"type":20,"tag":194,"props":3075,"children":3077},{"class":196,"line":3076},109,[3078,3082,3086,3090,3094,3098,3102,3106,3110,3114],{"type":20,"tag":194,"props":3079,"children":3080},{"style":252},[3081],{"type":30,"value":1591},{"type":20,"tag":194,"props":3083,"children":3084},{"style":252},[3085],{"type":30,"value":1031},{"type":20,"tag":194,"props":3087,"children":3088},{"style":680},[3089],{"type":30,"value":1159},{"type":20,"tag":194,"props":3091,"children":3092},{"style":264},[3093],{"type":30,"value":403},{"type":20,"tag":194,"props":3095,"children":3096},{"style":252},[3097],{"type":30,"value":393},{"type":20,"tag":194,"props":3099,"children":3100},{"style":264},[3101],{"type":30,"value":1172},{"type":20,"tag":194,"props":3103,"children":3104},{"style":406},[3105],{"type":30,"value":1177},{"type":20,"tag":194,"props":3107,"children":3108},{"style":264},[3109],{"type":30,"value":414},{"type":20,"tag":194,"props":3111,"children":3112},{"style":406},[3113],{"type":30,"value":1186},{"type":20,"tag":194,"props":3115,"children":3116},{"style":264},[3117],{"type":30,"value":442},{"type":20,"tag":194,"props":3119,"children":3121},{"class":196,"line":3120},110,[3122,3127],{"type":20,"tag":194,"props":3123,"children":3124},{"style":258},[3125],{"type":30,"value":3126},"            resolve",{"type":20,"tag":194,"props":3128,"children":3129},{"style":264},[3130],{"type":30,"value":1203},{"type":20,"tag":194,"props":3132,"children":3134},{"class":196,"line":3133},111,[3135],{"type":20,"tag":194,"props":3136,"children":3137},{"style":264},[3138],{"type":30,"value":2779},{"type":20,"tag":194,"props":3140,"children":3142},{"class":196,"line":3141},112,[3143],{"type":20,"tag":194,"props":3144,"children":3145},{"style":264},[3146],{"type":30,"value":1657},{"type":20,"tag":194,"props":3148,"children":3150},{"class":196,"line":3149},113,[3151],{"type":20,"tag":194,"props":3152,"children":3153},{"emptyLinePlaceholder":546},[3154],{"type":30,"value":549},{"type":20,"tag":194,"props":3156,"children":3158},{"class":196,"line":3157},114,[3159],{"type":20,"tag":194,"props":3160,"children":3161},{"style":201},[3162],{"type":30,"value":1399},{"type":20,"tag":194,"props":3164,"children":3166},{"class":196,"line":3165},115,[3167],{"type":20,"tag":194,"props":3168,"children":3169},{"style":201},[3170],{"type":30,"value":3171},"     * Override fetch on the global context, so that we can intercept\n",{"type":20,"tag":194,"props":3173,"children":3175},{"class":196,"line":3174},116,[3176],{"type":20,"tag":194,"props":3177,"children":3178},{"style":201},[3179],{"type":30,"value":3180},"     * fetch calls and respond with locally cached content, if available.\n",{"type":20,"tag":194,"props":3182,"children":3184},{"class":196,"line":3183},117,[3185],{"type":20,"tag":194,"props":3186,"children":3187},{"style":201},[3188],{"type":30,"value":3189},"     * New parameters available on the call to fetch:\n",{"type":20,"tag":194,"props":3191,"children":3193},{"class":196,"line":3192},118,[3194,3199],{"type":20,"tag":194,"props":3195,"children":3196},{"style":201},[3197],{"type":30,"value":3198},"     * localCache   : true",{"type":20,"tag":194,"props":3200,"children":3201},{"style":201},[3202],{"type":30,"value":3203}," // required - either a boolean (if true, localStorage is used,\n",{"type":20,"tag":194,"props":3205,"children":3207},{"class":196,"line":3206},119,[3208],{"type":20,"tag":194,"props":3209,"children":3210},{"style":201},[3211],{"type":30,"value":3212},"     * if false request is not cached or returned from cache), or an object implementing the\n",{"type":20,"tag":194,"props":3214,"children":3216},{"class":196,"line":3215},120,[3217],{"type":20,"tag":194,"props":3218,"children":3219},{"style":201},[3220],{"type":30,"value":3221},"     * Storage interface, in which case that object is used instead.\n",{"type":20,"tag":194,"props":3223,"children":3225},{"class":196,"line":3224},121,[3226,3231],{"type":20,"tag":194,"props":3227,"children":3228},{"style":201},[3229],{"type":30,"value":3230},"     * cacheTTL     : 5,",{"type":20,"tag":194,"props":3232,"children":3233},{"style":201},[3234],{"type":30,"value":3235}," // optional, cache time in hours, default is 5. Use float numbers for\n",{"type":20,"tag":194,"props":3237,"children":3239},{"class":196,"line":3238},122,[3240],{"type":20,"tag":194,"props":3241,"children":3242},{"style":201},[3243],{"type":30,"value":3244},"     * values less than a full hour (e.g. 0.5 for 1/2 hour).\n",{"type":20,"tag":194,"props":3246,"children":3248},{"class":196,"line":3247},123,[3249,3254],{"type":20,"tag":194,"props":3250,"children":3251},{"style":201},[3252],{"type":30,"value":3253},"     * cacheKey     : 'post',",{"type":20,"tag":194,"props":3255,"children":3256},{"style":201},[3257],{"type":30,"value":3258}," // optional - key under which cached string will be stored.\n",{"type":20,"tag":194,"props":3260,"children":3262},{"class":196,"line":3261},124,[3263,3268],{"type":20,"tag":194,"props":3264,"children":3265},{"style":201},[3266],{"type":30,"value":3267},"     * isCacheValid : function",{"type":20,"tag":194,"props":3269,"children":3270},{"style":201},[3271],{"type":30,"value":3272},"  // optional - return true for valid, false for invalid.\n",{"type":20,"tag":194,"props":3274,"children":3276},{"class":196,"line":3275},125,[3277],{"type":20,"tag":194,"props":3278,"children":3279},{"style":201},[3280],{"type":30,"value":1448},{"type":20,"tag":194,"props":3282,"children":3284},{"class":196,"line":3283},126,[3285,3290,3294,3299,3304,3308,3312,3316,3320],{"type":20,"tag":194,"props":3286,"children":3287},{"style":264},[3288],{"type":30,"value":3289},"    self.",{"type":20,"tag":194,"props":3291,"children":3292},{"style":258},[3293],{"type":30,"value":1332},{"type":20,"tag":194,"props":3295,"children":3296},{"style":252},[3297],{"type":30,"value":3298}," =",{"type":20,"tag":194,"props":3300,"children":3301},{"style":252},[3302],{"type":30,"value":3303}," function",{"type":20,"tag":194,"props":3305,"children":3306},{"style":264},[3307],{"type":30,"value":1172},{"type":20,"tag":194,"props":3309,"children":3310},{"style":406},[3311],{"type":30,"value":1470},{"type":20,"tag":194,"props":3313,"children":3314},{"style":264},[3315],{"type":30,"value":414},{"type":20,"tag":194,"props":3317,"children":3318},{"style":406},[3319],{"type":30,"value":1479},{"type":20,"tag":194,"props":3321,"children":3322},{"style":264},[3323],{"type":30,"value":442},{"type":20,"tag":194,"props":3325,"children":3327},{"class":196,"line":3326},127,[3328,3332,3336,3340,3344],{"type":20,"tag":194,"props":3329,"children":3330},{"style":252},[3331],{"type":30,"value":1491},{"type":20,"tag":194,"props":3333,"children":3334},{"style":264},[3335],{"type":30,"value":1866},{"type":20,"tag":194,"props":3337,"children":3338},{"style":252},[3339],{"type":30,"value":461},{"type":20,"tag":194,"props":3341,"children":3342},{"style":258},[3343],{"type":30,"value":1761},{"type":20,"tag":194,"props":3345,"children":3346},{"style":264},[3347],{"type":30,"value":3348},"(settings.localCache),\n",{"type":20,"tag":194,"props":3350,"children":3352},{"class":196,"line":3351},128,[3353,3358,3362,3367,3371,3376],{"type":20,"tag":194,"props":3354,"children":3355},{"style":264},[3356],{"type":30,"value":3357},"            hourstl ",{"type":20,"tag":194,"props":3359,"children":3360},{"style":252},[3361],{"type":30,"value":461},{"type":20,"tag":194,"props":3363,"children":3364},{"style":264},[3365],{"type":30,"value":3366}," settings.cacheTTL ",{"type":20,"tag":194,"props":3368,"children":3369},{"style":252},[3370],{"type":30,"value":519},{"type":20,"tag":194,"props":3372,"children":3373},{"style":680},[3374],{"type":30,"value":3375}," 5",{"type":20,"tag":194,"props":3377,"children":3378},{"style":264},[3379],{"type":30,"value":1075},{"type":20,"tag":194,"props":3381,"children":3383},{"class":196,"line":3382},129,[3384,3389,3393,3397],{"type":20,"tag":194,"props":3385,"children":3386},{"style":264},[3387],{"type":30,"value":3388},"            cacheKey ",{"type":20,"tag":194,"props":3390,"children":3391},{"style":252},[3392],{"type":30,"value":461},{"type":20,"tag":194,"props":3394,"children":3395},{"style":258},[3396],{"type":30,"value":1461},{"type":20,"tag":194,"props":3398,"children":3399},{"style":264},[3400],{"type":30,"value":3401},"(url, settings),\n",{"type":20,"tag":194,"props":3403,"children":3405},{"class":196,"line":3404},130,[3406,3411,3415],{"type":20,"tag":194,"props":3407,"children":3408},{"style":264},[3409],{"type":30,"value":3410},"            cacheValid ",{"type":20,"tag":194,"props":3412,"children":3413},{"style":252},[3414],{"type":30,"value":461},{"type":20,"tag":194,"props":3416,"children":3417},{"style":264},[3418],{"type":30,"value":3419}," settings.isCacheValid,\n",{"type":20,"tag":194,"props":3421,"children":3423},{"class":196,"line":3422},131,[3424],{"type":20,"tag":194,"props":3425,"children":3426},{"style":264},[3427],{"type":30,"value":3428},"            ttl,\n",{"type":20,"tag":194,"props":3430,"children":3432},{"class":196,"line":3431},132,[3433],{"type":20,"tag":194,"props":3434,"children":3435},{"style":264},[3436],{"type":30,"value":2974},{"type":20,"tag":194,"props":3438,"children":3440},{"class":196,"line":3439},133,[3441],{"type":20,"tag":194,"props":3442,"children":3443},{"style":264},[3444],{"type":30,"value":3445},"            dataType;\n",{"type":20,"tag":194,"props":3447,"children":3449},{"class":196,"line":3448},134,[3450],{"type":20,"tag":194,"props":3451,"children":3452},{"emptyLinePlaceholder":546},[3453],{"type":30,"value":549},{"type":20,"tag":194,"props":3455,"children":3457},{"class":196,"line":3456},135,[3458,3462,3466,3470,3474,3478,3483],{"type":20,"tag":194,"props":3459,"children":3460},{"style":252},[3461],{"type":30,"value":1782},{"type":20,"tag":194,"props":3463,"children":3464},{"style":264},[3465],{"type":30,"value":1172},{"type":20,"tag":194,"props":3467,"children":3468},{"style":252},[3469],{"type":30,"value":1369},{"type":20,"tag":194,"props":3471,"children":3472},{"style":264},[3473],{"type":30,"value":1795},{"type":20,"tag":194,"props":3475,"children":3476},{"style":252},[3477],{"type":30,"value":1379},{"type":20,"tag":194,"props":3479,"children":3480},{"style":258},[3481],{"type":30,"value":3482}," fetch",{"type":20,"tag":194,"props":3484,"children":3485},{"style":264},[3486],{"type":30,"value":3487},"(url, settings);\n",{"type":20,"tag":194,"props":3489,"children":3491},{"class":196,"line":3490},136,[3492],{"type":20,"tag":194,"props":3493,"children":3494},{"emptyLinePlaceholder":546},[3495],{"type":30,"value":549},{"type":20,"tag":194,"props":3497,"children":3499},{"class":196,"line":3498},137,[3500,3505,3509,3514,3519,3523,3527,3531],{"type":20,"tag":194,"props":3501,"children":3502},{"style":264},[3503],{"type":30,"value":3504},"        ttl ",{"type":20,"tag":194,"props":3506,"children":3507},{"style":252},[3508],{"type":30,"value":461},{"type":20,"tag":194,"props":3510,"children":3511},{"style":264},[3512],{"type":30,"value":3513}," storage.",{"type":20,"tag":194,"props":3515,"children":3516},{"style":258},[3517],{"type":30,"value":3518},"getItem",{"type":20,"tag":194,"props":3520,"children":3521},{"style":264},[3522],{"type":30,"value":644},{"type":20,"tag":194,"props":3524,"children":3525},{"style":252},[3526],{"type":30,"value":649},{"type":20,"tag":194,"props":3528,"children":3529},{"style":506},[3530],{"type":30,"value":654},{"type":20,"tag":194,"props":3532,"children":3533},{"style":264},[3534],{"type":30,"value":1649},{"type":20,"tag":194,"props":3536,"children":3538},{"class":196,"line":3537},138,[3539],{"type":20,"tag":194,"props":3540,"children":3541},{"emptyLinePlaceholder":546},[3542],{"type":30,"value":549},{"type":20,"tag":194,"props":3544,"children":3546},{"class":196,"line":3545},139,[3547,3551,3556,3560,3565,3570,3574,3579,3583,3588,3593],{"type":20,"tag":194,"props":3548,"children":3549},{"style":252},[3550],{"type":30,"value":1782},{"type":20,"tag":194,"props":3552,"children":3553},{"style":264},[3554],{"type":30,"value":3555}," (cacheValid ",{"type":20,"tag":194,"props":3557,"children":3558},{"style":252},[3559],{"type":30,"value":1920},{"type":20,"tag":194,"props":3561,"children":3562},{"style":252},[3563],{"type":30,"value":3564}," typeof",{"type":20,"tag":194,"props":3566,"children":3567},{"style":264},[3568],{"type":30,"value":3569}," cacheValid ",{"type":20,"tag":194,"props":3571,"children":3572},{"style":252},[3573],{"type":30,"value":1826},{"type":20,"tag":194,"props":3575,"children":3576},{"style":506},[3577],{"type":30,"value":3578}," 'function'",{"type":20,"tag":194,"props":3580,"children":3581},{"style":252},[3582],{"type":30,"value":1880},{"type":20,"tag":194,"props":3584,"children":3585},{"style":252},[3586],{"type":30,"value":3587}," !",{"type":20,"tag":194,"props":3589,"children":3590},{"style":258},[3591],{"type":30,"value":3592},"cacheValid",{"type":20,"tag":194,"props":3594,"children":3595},{"style":264},[3596],{"type":30,"value":3597},"()) {\n",{"type":20,"tag":194,"props":3599,"children":3601},{"class":196,"line":3600},140,[3602,3606],{"type":20,"tag":194,"props":3603,"children":3604},{"style":258},[3605],{"type":30,"value":777},{"type":20,"tag":194,"props":3607,"children":3608},{"style":264},[3609],{"type":30,"value":782},{"type":20,"tag":194,"props":3611,"children":3613},{"class":196,"line":3612},141,[3614,3619,3623,3628],{"type":20,"tag":194,"props":3615,"children":3616},{"style":264},[3617],{"type":30,"value":3618},"            ttl ",{"type":20,"tag":194,"props":3620,"children":3621},{"style":252},[3622],{"type":30,"value":461},{"type":20,"tag":194,"props":3624,"children":3625},{"style":680},[3626],{"type":30,"value":3627}," 0",{"type":20,"tag":194,"props":3629,"children":3630},{"style":264},[3631],{"type":30,"value":1384},{"type":20,"tag":194,"props":3633,"children":3635},{"class":196,"line":3634},142,[3636],{"type":20,"tag":194,"props":3637,"children":3638},{"style":264},[3639],{"type":30,"value":824},{"type":20,"tag":194,"props":3641,"children":3643},{"class":196,"line":3642},143,[3644],{"type":20,"tag":194,"props":3645,"children":3646},{"emptyLinePlaceholder":546},[3647],{"type":30,"value":549},{"type":20,"tag":194,"props":3649,"children":3651},{"class":196,"line":3650},144,[3652,3656,3661,3665,3670,3675,3680,3684],{"type":20,"tag":194,"props":3653,"children":3654},{"style":252},[3655],{"type":30,"value":1782},{"type":20,"tag":194,"props":3657,"children":3658},{"style":264},[3659],{"type":30,"value":3660}," (ttl ",{"type":20,"tag":194,"props":3662,"children":3663},{"style":252},[3664],{"type":30,"value":1920},{"type":20,"tag":194,"props":3666,"children":3667},{"style":264},[3668],{"type":30,"value":3669}," ttl ",{"type":20,"tag":194,"props":3671,"children":3672},{"style":252},[3673],{"type":30,"value":3674},"\u003C",{"type":20,"tag":194,"props":3676,"children":3677},{"style":252},[3678],{"type":30,"value":3679}," +new",{"type":20,"tag":194,"props":3681,"children":3682},{"style":258},[3683],{"type":30,"value":668},{"type":20,"tag":194,"props":3685,"children":3686},{"style":264},[3687],{"type":30,"value":3597},{"type":20,"tag":194,"props":3689,"children":3691},{"class":196,"line":3690},145,[3692,3696],{"type":20,"tag":194,"props":3693,"children":3694},{"style":258},[3695],{"type":30,"value":777},{"type":20,"tag":194,"props":3697,"children":3698},{"style":264},[3699],{"type":30,"value":782},{"type":20,"tag":194,"props":3701,"children":3703},{"class":196,"line":3702},146,[3704],{"type":20,"tag":194,"props":3705,"children":3706},{"style":264},[3707],{"type":30,"value":824},{"type":20,"tag":194,"props":3709,"children":3711},{"class":196,"line":3710},147,[3712],{"type":20,"tag":194,"props":3713,"children":3714},{"emptyLinePlaceholder":546},[3715],{"type":30,"value":549},{"type":20,"tag":194,"props":3717,"children":3719},{"class":196,"line":3718},148,[3720,3725,3729,3733,3737],{"type":20,"tag":194,"props":3721,"children":3722},{"style":264},[3723],{"type":30,"value":3724},"        value ",{"type":20,"tag":194,"props":3726,"children":3727},{"style":252},[3728],{"type":30,"value":461},{"type":20,"tag":194,"props":3730,"children":3731},{"style":264},[3732],{"type":30,"value":3513},{"type":20,"tag":194,"props":3734,"children":3735},{"style":258},[3736],{"type":30,"value":3518},{"type":20,"tag":194,"props":3738,"children":3739},{"style":264},[3740],{"type":30,"value":2144},{"type":20,"tag":194,"props":3742,"children":3744},{"class":196,"line":3743},149,[3745],{"type":20,"tag":194,"props":3746,"children":3747},{"emptyLinePlaceholder":546},[3748],{"type":30,"value":549},{"type":20,"tag":194,"props":3750,"children":3752},{"class":196,"line":3751},150,[3753,3757,3761,3765],{"type":20,"tag":194,"props":3754,"children":3755},{"style":252},[3756],{"type":30,"value":1782},{"type":20,"tag":194,"props":3758,"children":3759},{"style":264},[3760],{"type":30,"value":1172},{"type":20,"tag":194,"props":3762,"children":3763},{"style":252},[3764],{"type":30,"value":1369},{"type":20,"tag":194,"props":3766,"children":3767},{"style":264},[3768],{"type":30,"value":3769},"value) {\n",{"type":20,"tag":194,"props":3771,"children":3773},{"class":196,"line":3772},151,[3774],{"type":20,"tag":194,"props":3775,"children":3776},{"style":201},[3777],{"type":30,"value":3778},"            /* If not cached, we'll make the request and add a then block to the resulting promise,\n",{"type":20,"tag":194,"props":3780,"children":3782},{"class":196,"line":3781},152,[3783],{"type":20,"tag":194,"props":3784,"children":3785},{"style":201},[3786],{"type":30,"value":3787},"             in which we'll cache the result. */\n",{"type":20,"tag":194,"props":3789,"children":3791},{"class":196,"line":3790},153,[3792,3796,3800,3805,3809,3814,3819,3823,3828],{"type":20,"tag":194,"props":3793,"children":3794},{"style":252},[3795],{"type":30,"value":1943},{"type":20,"tag":194,"props":3797,"children":3798},{"style":258},[3799],{"type":30,"value":3482},{"type":20,"tag":194,"props":3801,"children":3802},{"style":264},[3803],{"type":30,"value":3804},"(url, settings).",{"type":20,"tag":194,"props":3806,"children":3807},{"style":258},[3808],{"type":30,"value":572},{"type":20,"tag":194,"props":3810,"children":3811},{"style":264},[3812],{"type":30,"value":3813},"(cacheResponse.",{"type":20,"tag":194,"props":3815,"children":3816},{"style":258},[3817],{"type":30,"value":3818},"bind",{"type":20,"tag":194,"props":3820,"children":3821},{"style":264},[3822],{"type":30,"value":403},{"type":20,"tag":194,"props":3824,"children":3825},{"style":680},[3826],{"type":30,"value":3827},"null",{"type":20,"tag":194,"props":3829,"children":3830},{"style":264},[3831],{"type":30,"value":3832},", cacheKey, storage, hourstl));\n",{"type":20,"tag":194,"props":3834,"children":3836},{"class":196,"line":3835},154,[3837],{"type":20,"tag":194,"props":3838,"children":3839},{"style":264},[3840],{"type":30,"value":824},{"type":20,"tag":194,"props":3842,"children":3844},{"class":196,"line":3843},155,[3845],{"type":20,"tag":194,"props":3846,"children":3847},{"emptyLinePlaceholder":546},[3848],{"type":30,"value":549},{"type":20,"tag":194,"props":3850,"children":3852},{"class":196,"line":3851},156,[3853],{"type":20,"tag":194,"props":3854,"children":3855},{"style":201},[3856],{"type":30,"value":3857},"        /* Value is cached, so we'll simply create and respond with a promise of our own,\n",{"type":20,"tag":194,"props":3859,"children":3861},{"class":196,"line":3860},157,[3862],{"type":20,"tag":194,"props":3863,"children":3864},{"style":201},[3865],{"type":30,"value":3866},"         and provide a response object. */\n",{"type":20,"tag":194,"props":3868,"children":3870},{"class":196,"line":3869},158,[3871,3875,3879,3883,3887,3891,3895,3899,3903,3907,3911],{"type":20,"tag":194,"props":3872,"children":3873},{"style":264},[3874],{"type":30,"value":485},{"type":20,"tag":194,"props":3876,"children":3877},{"style":252},[3878],{"type":30,"value":461},{"type":20,"tag":194,"props":3880,"children":3881},{"style":264},[3882],{"type":30,"value":3513},{"type":20,"tag":194,"props":3884,"children":3885},{"style":258},[3886],{"type":30,"value":3518},{"type":20,"tag":194,"props":3888,"children":3889},{"style":264},[3890],{"type":30,"value":644},{"type":20,"tag":194,"props":3892,"children":3893},{"style":252},[3894],{"type":30,"value":649},{"type":20,"tag":194,"props":3896,"children":3897},{"style":506},[3898],{"type":30,"value":735},{"type":20,"tag":194,"props":3900,"children":3901},{"style":264},[3902],{"type":30,"value":514},{"type":20,"tag":194,"props":3904,"children":3905},{"style":252},[3906],{"type":30,"value":519},{"type":20,"tag":194,"props":3908,"children":3909},{"style":506},[3910],{"type":30,"value":524},{"type":20,"tag":194,"props":3912,"children":3913},{"style":264},[3914],{"type":30,"value":1384},{"type":20,"tag":194,"props":3916,"children":3918},{"class":196,"line":3917},159,[3919,3923,3927],{"type":20,"tag":194,"props":3920,"children":3921},{"style":252},[3922],{"type":30,"value":1591},{"type":20,"tag":194,"props":3924,"children":3925},{"style":258},[3926],{"type":30,"value":988},{"type":20,"tag":194,"props":3928,"children":3929},{"style":264},[3930],{"type":30,"value":3931},"(value, dataType);\n",{"type":20,"tag":194,"props":3933,"children":3935},{"class":196,"line":3934},160,[3936],{"type":20,"tag":194,"props":3937,"children":3938},{"style":264},[3939],{"type":30,"value":3940},"    };\n",{"type":20,"tag":194,"props":3942,"children":3944},{"class":196,"line":3943},161,[3945],{"type":20,"tag":194,"props":3946,"children":3947},{"style":264},[3948],{"type":30,"value":3949},"})(self.fetch);\n",{"type":20,"tag":3951,"props":3952,"children":3953},"style",{},[3954],{"type":30,"value":3955},"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":216,"depth":216,"links":3957},[3958,3959,3960,3961,3962],{"id":37,"depth":216,"text":40},{"id":58,"depth":216,"text":61},{"id":124,"depth":216,"text":127},{"id":144,"depth":216,"text":147},{"id":1233,"depth":216,"text":1236},"markdown","content:ckeefer:2016-7:goFetch2.md","content","ckeefer/2016-7/goFetch2.md","ckeefer/2016-7/goFetch2","md",{"user":3970,"name":3971},"ckeefer","Christopher Keefer",{"_path":3973,"_dir":3974,"_draft":7,"_partial":7,"_locale":8,"title":3975,"description":3976,"publishDate":3977,"tags":3978,"excerpt":3976,"body":3979,"_type":3963,"_id":5371,"_source":3965,"_file":5372,"_stem":5373,"_extension":3968,"author":5374},"/ckeefer/2016-6/gofetch1","2016-6","Go Fetch! (JavaScript Fetch API)","Long ago, we briefly brushed upon the topic of what has made jQuery such a valuable part of the web developer's toolset for such a long time - namely, a cleaner interface for interacting with the DOM, and the $.ajax abstraction over XMLHttpRequest.","2016-10-03",[13,14,15],{"type":17,"children":3980,"toc":5363},[3981,3992,4020,4025,4031,4036,4043,4373,4408,4413,4599,4611,4615,4814,4836,4841,4847,4901,4906,4912,4946,4952,4957,5272,5285,5298,5303,5308,5314,5319,5325,5359],{"type":20,"tag":21,"props":3982,"children":3983},{},[3984,3990],{"type":20,"tag":25,"props":3985,"children":3987},{"href":3986},"/search/jquery/ajax/blobs/user:ckeefer",[3988],{"type":30,"value":3989},"Long ago",{"type":30,"value":3991},", we briefly brushed upon the topic of what has made jQuery such a valuable part of the web developer's toolset for such a long time - namely, a cleaner interface for interacting with the DOM, and the $.ajax abstraction over XMLHttpRequest.",{"type":20,"tag":21,"props":3993,"children":3994},{},[3995,3997,4003,4004,4010,4012,4019],{"type":30,"value":3996},"These days, I would go a step farther and discuss how it has positively influenced browser APIs. jQuery offered a way to find elements using their css selectors, and this eventually gave us ",{"type":20,"tag":68,"props":3998,"children":4000},{"className":3999},[],[4001],{"type":30,"value":4002},"document.querySelector",{"type":30,"value":174},{"type":20,"tag":68,"props":4005,"children":4007},{"className":4006},[],[4008],{"type":30,"value":4009},"document.querySelectorAll",{"type":30,"value":4011},". More recently, browser developers have taken another page from jQuery's playbook and introduced a new, Promise-based API for making asynchronous requests, and so much more - ",{"type":20,"tag":25,"props":4013,"children":4016},{"href":4014,"rel":4015},"https://developer.mozilla.org/en/docs/Web/API/Fetch_API",[50],[4017],{"type":30,"value":4018},"Fetch",{"type":30,"value":55},{"type":20,"tag":21,"props":4021,"children":4022},{},[4023],{"type":30,"value":4024},"Why go Fetch? Let's take a look.",{"type":20,"tag":35,"props":4026,"children":4028},{"id":4027},"a-comparison",[4029],{"type":30,"value":4030},"A Comparison",{"type":20,"tag":21,"props":4032,"children":4033},{},[4034],{"type":30,"value":4035},"First, let's take a look at what a simple request using three different APIs might look like - first, our old friend XMLHttpRequest, then jQuery's ajax, and then Fetch.",{"type":20,"tag":4037,"props":4038,"children":4040},"h5",{"id":4039},"xmlhttprequest",[4041],{"type":30,"value":4042},"XMLHttpRequest",{"type":20,"tag":184,"props":4044,"children":4046},{"className":186,"code":4045,"language":188,"meta":8,"style":8},"var xhr = new XMLHttpRequest();\n\nxhr.addEventListener('load', function(){\n    var json = this.response || JSON.parse(this.responseText);\n    console.log(json);\n});\n\nxhr.addEventListener('error', function(err){\n    console.log(\"Oh dear, something went wrong: \", err);\n});\n\nxhr.responseType = 'json';\nxhr.open('get', '//jsonplaceholder.typicode.com/users', true);\nxhr.send();\n",[4047],{"type":20,"tag":68,"props":4048,"children":4049},{"__ignoreMap":8},[4050,4080,4087,4122,4180,4197,4205,4212,4254,4279,4286,4293,4314,4357],{"type":20,"tag":194,"props":4051,"children":4052},{"class":196,"line":197},[4053,4058,4063,4067,4071,4076],{"type":20,"tag":194,"props":4054,"children":4055},{"style":252},[4056],{"type":30,"value":4057},"var",{"type":20,"tag":194,"props":4059,"children":4060},{"style":264},[4061],{"type":30,"value":4062}," xhr ",{"type":20,"tag":194,"props":4064,"children":4065},{"style":252},[4066],{"type":30,"value":461},{"type":20,"tag":194,"props":4068,"children":4069},{"style":252},[4070],{"type":30,"value":1031},{"type":20,"tag":194,"props":4072,"children":4073},{"style":258},[4074],{"type":30,"value":4075}," XMLHttpRequest",{"type":20,"tag":194,"props":4077,"children":4078},{"style":264},[4079],{"type":30,"value":539},{"type":20,"tag":194,"props":4081,"children":4082},{"class":196,"line":207},[4083],{"type":20,"tag":194,"props":4084,"children":4085},{"emptyLinePlaceholder":546},[4086],{"type":30,"value":549},{"type":20,"tag":194,"props":4088,"children":4089},{"class":196,"line":216},[4090,4095,4100,4104,4109,4113,4117],{"type":20,"tag":194,"props":4091,"children":4092},{"style":264},[4093],{"type":30,"value":4094},"xhr.",{"type":20,"tag":194,"props":4096,"children":4097},{"style":258},[4098],{"type":30,"value":4099},"addEventListener",{"type":20,"tag":194,"props":4101,"children":4102},{"style":264},[4103],{"type":30,"value":403},{"type":20,"tag":194,"props":4105,"children":4106},{"style":506},[4107],{"type":30,"value":4108},"'load'",{"type":20,"tag":194,"props":4110,"children":4111},{"style":264},[4112],{"type":30,"value":414},{"type":20,"tag":194,"props":4114,"children":4115},{"style":252},[4116],{"type":30,"value":393},{"type":20,"tag":194,"props":4118,"children":4119},{"style":264},[4120],{"type":30,"value":4121},"(){\n",{"type":20,"tag":194,"props":4123,"children":4124},{"class":196,"line":225},[4125,4129,4134,4138,4143,4148,4152,4157,4161,4166,4170,4175],{"type":20,"tag":194,"props":4126,"children":4127},{"style":252},[4128],{"type":30,"value":451},{"type":20,"tag":194,"props":4130,"children":4131},{"style":264},[4132],{"type":30,"value":4133}," json ",{"type":20,"tag":194,"props":4135,"children":4136},{"style":252},[4137],{"type":30,"value":461},{"type":20,"tag":194,"props":4139,"children":4140},{"style":680},[4141],{"type":30,"value":4142}," this",{"type":20,"tag":194,"props":4144,"children":4145},{"style":264},[4146],{"type":30,"value":4147},".response ",{"type":20,"tag":194,"props":4149,"children":4150},{"style":252},[4151],{"type":30,"value":519},{"type":20,"tag":194,"props":4153,"children":4154},{"style":680},[4155],{"type":30,"value":4156}," JSON",{"type":20,"tag":194,"props":4158,"children":4159},{"style":264},[4160],{"type":30,"value":55},{"type":20,"tag":194,"props":4162,"children":4163},{"style":258},[4164],{"type":30,"value":4165},"parse",{"type":20,"tag":194,"props":4167,"children":4168},{"style":264},[4169],{"type":30,"value":403},{"type":20,"tag":194,"props":4171,"children":4172},{"style":680},[4173],{"type":30,"value":4174},"this",{"type":20,"tag":194,"props":4176,"children":4177},{"style":264},[4178],{"type":30,"value":4179},".responseText);\n",{"type":20,"tag":194,"props":4181,"children":4182},{"class":196,"line":234},[4183,4188,4192],{"type":20,"tag":194,"props":4184,"children":4185},{"style":264},[4186],{"type":30,"value":4187},"    console.",{"type":20,"tag":194,"props":4189,"children":4190},{"style":258},[4191],{"type":30,"value":796},{"type":20,"tag":194,"props":4193,"children":4194},{"style":264},[4195],{"type":30,"value":4196},"(json);\n",{"type":20,"tag":194,"props":4198,"children":4199},{"class":196,"line":243},[4200],{"type":20,"tag":194,"props":4201,"children":4202},{"style":264},[4203],{"type":30,"value":4204},"});\n",{"type":20,"tag":194,"props":4206,"children":4207},{"class":196,"line":275},[4208],{"type":20,"tag":194,"props":4209,"children":4210},{"emptyLinePlaceholder":546},[4211],{"type":30,"value":549},{"type":20,"tag":194,"props":4213,"children":4214},{"class":196,"line":284},[4215,4219,4223,4227,4232,4236,4240,4244,4249],{"type":20,"tag":194,"props":4216,"children":4217},{"style":264},[4218],{"type":30,"value":4094},{"type":20,"tag":194,"props":4220,"children":4221},{"style":258},[4222],{"type":30,"value":4099},{"type":20,"tag":194,"props":4224,"children":4225},{"style":264},[4226],{"type":30,"value":403},{"type":20,"tag":194,"props":4228,"children":4229},{"style":506},[4230],{"type":30,"value":4231},"'error'",{"type":20,"tag":194,"props":4233,"children":4234},{"style":264},[4235],{"type":30,"value":414},{"type":20,"tag":194,"props":4237,"children":4238},{"style":252},[4239],{"type":30,"value":393},{"type":20,"tag":194,"props":4241,"children":4242},{"style":264},[4243],{"type":30,"value":403},{"type":20,"tag":194,"props":4245,"children":4246},{"style":406},[4247],{"type":30,"value":4248},"err",{"type":20,"tag":194,"props":4250,"children":4251},{"style":264},[4252],{"type":30,"value":4253},"){\n",{"type":20,"tag":194,"props":4255,"children":4256},{"class":196,"line":311},[4257,4261,4265,4269,4274],{"type":20,"tag":194,"props":4258,"children":4259},{"style":264},[4260],{"type":30,"value":4187},{"type":20,"tag":194,"props":4262,"children":4263},{"style":258},[4264],{"type":30,"value":796},{"type":20,"tag":194,"props":4266,"children":4267},{"style":264},[4268],{"type":30,"value":403},{"type":20,"tag":194,"props":4270,"children":4271},{"style":506},[4272],{"type":30,"value":4273},"\"Oh dear, something went wrong: \"",{"type":20,"tag":194,"props":4275,"children":4276},{"style":264},[4277],{"type":30,"value":4278},", err);\n",{"type":20,"tag":194,"props":4280,"children":4281},{"class":196,"line":320},[4282],{"type":20,"tag":194,"props":4283,"children":4284},{"style":264},[4285],{"type":30,"value":4204},{"type":20,"tag":194,"props":4287,"children":4288},{"class":196,"line":347},[4289],{"type":20,"tag":194,"props":4290,"children":4291},{"emptyLinePlaceholder":546},[4292],{"type":30,"value":549},{"type":20,"tag":194,"props":4294,"children":4295},{"class":196,"line":356},[4296,4301,4305,4310],{"type":20,"tag":194,"props":4297,"children":4298},{"style":264},[4299],{"type":30,"value":4300},"xhr.responseType ",{"type":20,"tag":194,"props":4302,"children":4303},{"style":252},[4304],{"type":30,"value":461},{"type":20,"tag":194,"props":4306,"children":4307},{"style":506},[4308],{"type":30,"value":4309}," 'json'",{"type":20,"tag":194,"props":4311,"children":4312},{"style":264},[4313],{"type":30,"value":1384},{"type":20,"tag":194,"props":4315,"children":4316},{"class":196,"line":378},[4317,4321,4326,4330,4335,4339,4344,4348,4353],{"type":20,"tag":194,"props":4318,"children":4319},{"style":264},[4320],{"type":30,"value":4094},{"type":20,"tag":194,"props":4322,"children":4323},{"style":258},[4324],{"type":30,"value":4325},"open",{"type":20,"tag":194,"props":4327,"children":4328},{"style":264},[4329],{"type":30,"value":403},{"type":20,"tag":194,"props":4331,"children":4332},{"style":506},[4333],{"type":30,"value":4334},"'get'",{"type":20,"tag":194,"props":4336,"children":4337},{"style":264},[4338],{"type":30,"value":414},{"type":20,"tag":194,"props":4340,"children":4341},{"style":506},[4342],{"type":30,"value":4343},"'//jsonplaceholder.typicode.com/users'",{"type":20,"tag":194,"props":4345,"children":4346},{"style":264},[4347],{"type":30,"value":414},{"type":20,"tag":194,"props":4349,"children":4350},{"style":680},[4351],{"type":30,"value":4352},"true",{"type":20,"tag":194,"props":4354,"children":4355},{"style":264},[4356],{"type":30,"value":1649},{"type":20,"tag":194,"props":4358,"children":4359},{"class":196,"line":387},[4360,4364,4369],{"type":20,"tag":194,"props":4361,"children":4362},{"style":264},[4363],{"type":30,"value":4094},{"type":20,"tag":194,"props":4365,"children":4366},{"style":258},[4367],{"type":30,"value":4368},"send",{"type":20,"tag":194,"props":4370,"children":4371},{"style":264},[4372],{"type":30,"value":539},{"type":20,"tag":21,"props":4374,"children":4375},{},[4376,4378,4384,4386,4392,4393,4399,4401,4406],{"type":30,"value":4377},"Not terrible, of course, but a little more verbose than we might like, and we don't get the nice, logical progression of ",{"type":20,"tag":4379,"props":4380,"children":4381},"em",{},[4382],{"type":30,"value":4383},"this-then-that",{"type":30,"value":4385}," in our code, since we have to assign our ",{"type":20,"tag":68,"props":4387,"children":4389},{"className":4388},[],[4390],{"type":30,"value":4391},"load",{"type":30,"value":174},{"type":20,"tag":68,"props":4394,"children":4396},{"className":4395},[],[4397],{"type":30,"value":4398},"error",{"type":30,"value":4400}," event handlers before we make the ",{"type":20,"tag":68,"props":4402,"children":4404},{"className":4403},[],[4405],{"type":30,"value":4368},{"type":30,"value":4407}," call.",{"type":20,"tag":4037,"props":4409,"children":4410},{"id":14},[4411],{"type":30,"value":4412},"jQuery",{"type":20,"tag":184,"props":4414,"children":4416},{"className":186,"code":4415,"language":188,"meta":8,"style":8},"$.ajax({\n    type:'GET',\n    url:'//jsonplaceholder.typicode.com/users',\n    dataType:'json'\n}).done(function(data){ \n    console.log(data); \n}).fail(function(jqXHR){\n    console.log(\"Oh dear, something went wrong: \", jqXHR.status, jqXHR.responseText);\n});\n",[4417],{"type":20,"tag":68,"props":4418,"children":4419},{"__ignoreMap":8},[4420,4438,4455,4471,4484,4519,4535,4568,4592],{"type":20,"tag":194,"props":4421,"children":4422},{"class":196,"line":197},[4423,4428,4433],{"type":20,"tag":194,"props":4424,"children":4425},{"style":264},[4426],{"type":30,"value":4427},"$.",{"type":20,"tag":194,"props":4429,"children":4430},{"style":258},[4431],{"type":30,"value":4432},"ajax",{"type":20,"tag":194,"props":4434,"children":4435},{"style":264},[4436],{"type":30,"value":4437},"({\n",{"type":20,"tag":194,"props":4439,"children":4440},{"class":196,"line":207},[4441,4446,4451],{"type":20,"tag":194,"props":4442,"children":4443},{"style":264},[4444],{"type":30,"value":4445},"    type:",{"type":20,"tag":194,"props":4447,"children":4448},{"style":506},[4449],{"type":30,"value":4450},"'GET'",{"type":20,"tag":194,"props":4452,"children":4453},{"style":264},[4454],{"type":30,"value":1075},{"type":20,"tag":194,"props":4456,"children":4457},{"class":196,"line":216},[4458,4463,4467],{"type":20,"tag":194,"props":4459,"children":4460},{"style":264},[4461],{"type":30,"value":4462},"    url:",{"type":20,"tag":194,"props":4464,"children":4465},{"style":506},[4466],{"type":30,"value":4343},{"type":20,"tag":194,"props":4468,"children":4469},{"style":264},[4470],{"type":30,"value":1075},{"type":20,"tag":194,"props":4472,"children":4473},{"class":196,"line":225},[4474,4479],{"type":20,"tag":194,"props":4475,"children":4476},{"style":264},[4477],{"type":30,"value":4478},"    dataType:",{"type":20,"tag":194,"props":4480,"children":4481},{"style":506},[4482],{"type":30,"value":4483},"'json'\n",{"type":20,"tag":194,"props":4485,"children":4486},{"class":196,"line":234},[4487,4492,4497,4501,4505,4509,4514],{"type":20,"tag":194,"props":4488,"children":4489},{"style":264},[4490],{"type":30,"value":4491},"}).",{"type":20,"tag":194,"props":4493,"children":4494},{"style":258},[4495],{"type":30,"value":4496},"done",{"type":20,"tag":194,"props":4498,"children":4499},{"style":264},[4500],{"type":30,"value":403},{"type":20,"tag":194,"props":4502,"children":4503},{"style":252},[4504],{"type":30,"value":393},{"type":20,"tag":194,"props":4506,"children":4507},{"style":264},[4508],{"type":30,"value":403},{"type":20,"tag":194,"props":4510,"children":4511},{"style":406},[4512],{"type":30,"value":4513},"data",{"type":20,"tag":194,"props":4515,"children":4516},{"style":264},[4517],{"type":30,"value":4518},"){ \n",{"type":20,"tag":194,"props":4520,"children":4521},{"class":196,"line":243},[4522,4526,4530],{"type":20,"tag":194,"props":4523,"children":4524},{"style":264},[4525],{"type":30,"value":4187},{"type":20,"tag":194,"props":4527,"children":4528},{"style":258},[4529],{"type":30,"value":796},{"type":20,"tag":194,"props":4531,"children":4532},{"style":264},[4533],{"type":30,"value":4534},"(data); \n",{"type":20,"tag":194,"props":4536,"children":4537},{"class":196,"line":275},[4538,4542,4547,4551,4555,4559,4564],{"type":20,"tag":194,"props":4539,"children":4540},{"style":264},[4541],{"type":30,"value":4491},{"type":20,"tag":194,"props":4543,"children":4544},{"style":258},[4545],{"type":30,"value":4546},"fail",{"type":20,"tag":194,"props":4548,"children":4549},{"style":264},[4550],{"type":30,"value":403},{"type":20,"tag":194,"props":4552,"children":4553},{"style":252},[4554],{"type":30,"value":393},{"type":20,"tag":194,"props":4556,"children":4557},{"style":264},[4558],{"type":30,"value":403},{"type":20,"tag":194,"props":4560,"children":4561},{"style":406},[4562],{"type":30,"value":4563},"jqXHR",{"type":20,"tag":194,"props":4565,"children":4566},{"style":264},[4567],{"type":30,"value":4253},{"type":20,"tag":194,"props":4569,"children":4570},{"class":196,"line":284},[4571,4575,4579,4583,4587],{"type":20,"tag":194,"props":4572,"children":4573},{"style":264},[4574],{"type":30,"value":4187},{"type":20,"tag":194,"props":4576,"children":4577},{"style":258},[4578],{"type":30,"value":796},{"type":20,"tag":194,"props":4580,"children":4581},{"style":264},[4582],{"type":30,"value":403},{"type":20,"tag":194,"props":4584,"children":4585},{"style":506},[4586],{"type":30,"value":4273},{"type":20,"tag":194,"props":4588,"children":4589},{"style":264},[4590],{"type":30,"value":4591},", jqXHR.status, jqXHR.responseText);\n",{"type":20,"tag":194,"props":4593,"children":4594},{"class":196,"line":311},[4595],{"type":20,"tag":194,"props":4596,"children":4597},{"style":264},[4598],{"type":30,"value":4204},{"type":20,"tag":21,"props":4600,"children":4601},{},[4602,4604,4609],{"type":30,"value":4603},"Ah, much nicer - we can specify all the parameters to the ajax call within a single settings object, and with Deferred support baked in since v1.4, we can dangle a ",{"type":20,"tag":68,"props":4605,"children":4607},{"className":4606},[],[4608],{"type":30,"value":4496},{"type":30,"value":4610}," block after our call, keeping the logic more compact and readable.",{"type":20,"tag":4037,"props":4612,"children":4613},{"id":1332},[4614],{"type":30,"value":4018},{"type":20,"tag":184,"props":4616,"children":4618},{"className":186,"code":4617,"language":188,"meta":8,"style":8},"fetch('//jsonplaceholder.typicode.com/users', {\n    method:'GET'\n}).then((response) => {\n    return response.json();\n}).then((json) => {\n    console.log(json);\n}).catch((err) => {\n    console.log(\"Oh dear, something went wrong: \", err);\n});;\n",[4619],{"type":20,"tag":68,"props":4620,"children":4621},{"__ignoreMap":8},[4622,4642,4655,4686,4706,4737,4752,4783,4806],{"type":20,"tag":194,"props":4623,"children":4624},{"class":196,"line":197},[4625,4629,4633,4637],{"type":20,"tag":194,"props":4626,"children":4627},{"style":258},[4628],{"type":30,"value":1332},{"type":20,"tag":194,"props":4630,"children":4631},{"style":264},[4632],{"type":30,"value":403},{"type":20,"tag":194,"props":4634,"children":4635},{"style":506},[4636],{"type":30,"value":4343},{"type":20,"tag":194,"props":4638,"children":4639},{"style":264},[4640],{"type":30,"value":4641},", {\n",{"type":20,"tag":194,"props":4643,"children":4644},{"class":196,"line":207},[4645,4650],{"type":20,"tag":194,"props":4646,"children":4647},{"style":264},[4648],{"type":30,"value":4649},"    method:",{"type":20,"tag":194,"props":4651,"children":4652},{"style":506},[4653],{"type":30,"value":4654},"'GET'\n",{"type":20,"tag":194,"props":4656,"children":4657},{"class":196,"line":216},[4658,4662,4666,4670,4674,4678,4682],{"type":20,"tag":194,"props":4659,"children":4660},{"style":264},[4661],{"type":30,"value":4491},{"type":20,"tag":194,"props":4663,"children":4664},{"style":258},[4665],{"type":30,"value":572},{"type":20,"tag":194,"props":4667,"children":4668},{"style":264},[4669],{"type":30,"value":577},{"type":20,"tag":194,"props":4671,"children":4672},{"style":406},[4673],{"type":30,"value":437},{"type":20,"tag":194,"props":4675,"children":4676},{"style":264},[4677],{"type":30,"value":514},{"type":20,"tag":194,"props":4679,"children":4680},{"style":252},[4681],{"type":30,"value":590},{"type":20,"tag":194,"props":4683,"children":4684},{"style":264},[4685],{"type":30,"value":595},{"type":20,"tag":194,"props":4687,"children":4688},{"class":196,"line":225},[4689,4693,4697,4702],{"type":20,"tag":194,"props":4690,"children":4691},{"style":252},[4692],{"type":30,"value":850},{"type":20,"tag":194,"props":4694,"children":4695},{"style":264},[4696],{"type":30,"value":466},{"type":20,"tag":194,"props":4698,"children":4699},{"style":258},[4700],{"type":30,"value":4701},"json",{"type":20,"tag":194,"props":4703,"children":4704},{"style":264},[4705],{"type":30,"value":539},{"type":20,"tag":194,"props":4707,"children":4708},{"class":196,"line":234},[4709,4713,4717,4721,4725,4729,4733],{"type":20,"tag":194,"props":4710,"children":4711},{"style":264},[4712],{"type":30,"value":4491},{"type":20,"tag":194,"props":4714,"children":4715},{"style":258},[4716],{"type":30,"value":572},{"type":20,"tag":194,"props":4718,"children":4719},{"style":264},[4720],{"type":30,"value":577},{"type":20,"tag":194,"props":4722,"children":4723},{"style":406},[4724],{"type":30,"value":4701},{"type":20,"tag":194,"props":4726,"children":4727},{"style":264},[4728],{"type":30,"value":514},{"type":20,"tag":194,"props":4730,"children":4731},{"style":252},[4732],{"type":30,"value":590},{"type":20,"tag":194,"props":4734,"children":4735},{"style":264},[4736],{"type":30,"value":595},{"type":20,"tag":194,"props":4738,"children":4739},{"class":196,"line":243},[4740,4744,4748],{"type":20,"tag":194,"props":4741,"children":4742},{"style":264},[4743],{"type":30,"value":4187},{"type":20,"tag":194,"props":4745,"children":4746},{"style":258},[4747],{"type":30,"value":796},{"type":20,"tag":194,"props":4749,"children":4750},{"style":264},[4751],{"type":30,"value":4196},{"type":20,"tag":194,"props":4753,"children":4754},{"class":196,"line":275},[4755,4759,4763,4767,4771,4775,4779],{"type":20,"tag":194,"props":4756,"children":4757},{"style":264},[4758],{"type":30,"value":4491},{"type":20,"tag":194,"props":4760,"children":4761},{"style":258},[4762],{"type":30,"value":754},{"type":20,"tag":194,"props":4764,"children":4765},{"style":264},[4766],{"type":30,"value":577},{"type":20,"tag":194,"props":4768,"children":4769},{"style":406},[4770],{"type":30,"value":4248},{"type":20,"tag":194,"props":4772,"children":4773},{"style":264},[4774],{"type":30,"value":514},{"type":20,"tag":194,"props":4776,"children":4777},{"style":252},[4778],{"type":30,"value":590},{"type":20,"tag":194,"props":4780,"children":4781},{"style":264},[4782],{"type":30,"value":595},{"type":20,"tag":194,"props":4784,"children":4785},{"class":196,"line":284},[4786,4790,4794,4798,4802],{"type":20,"tag":194,"props":4787,"children":4788},{"style":264},[4789],{"type":30,"value":4187},{"type":20,"tag":194,"props":4791,"children":4792},{"style":258},[4793],{"type":30,"value":796},{"type":20,"tag":194,"props":4795,"children":4796},{"style":264},[4797],{"type":30,"value":403},{"type":20,"tag":194,"props":4799,"children":4800},{"style":506},[4801],{"type":30,"value":4273},{"type":20,"tag":194,"props":4803,"children":4804},{"style":264},[4805],{"type":30,"value":4278},{"type":20,"tag":194,"props":4807,"children":4808},{"class":196,"line":311},[4809],{"type":20,"tag":194,"props":4810,"children":4811},{"style":264},[4812],{"type":30,"value":4813},"});;\n",{"type":20,"tag":21,"props":4815,"children":4816},{},[4817,4819,4826,4827,4834],{"type":30,"value":4818},"You can see the similarities to the $.ajax example, but the fetch API manages to be both a tad more compact - in part thanks to ",{"type":20,"tag":25,"props":4820,"children":4823},{"href":4821,"rel":4822},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",[50],[4824],{"type":30,"value":4825},"Promises",{"type":30,"value":174},{"type":20,"tag":25,"props":4828,"children":4831},{"href":4829,"rel":4830},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions",[50],[4832],{"type":30,"value":4833},"Arrow Functions",{"type":30,"value":4835}," - and more powerful in a variety of ways.",{"type":20,"tag":21,"props":4837,"children":4838},{},[4839],{"type":30,"value":4840},"For instance, let's talk a little about the Response readers, and the Response and Request objects.",{"type":20,"tag":35,"props":4842,"children":4844},{"id":4843},"response-readers",[4845],{"type":30,"value":4846},"Response Readers",{"type":20,"tag":21,"props":4848,"children":4849},{},[4850,4852,4857,4859,4865,4867,4872,4873,4878,4879,4885,4886,4892,4893,4899],{"type":30,"value":4851},"You'll notice in the example above that our initial ",{"type":20,"tag":68,"props":4853,"children":4855},{"className":4854},[],[4856],{"type":30,"value":572},{"type":30,"value":4858}," block returns a call to .json() on the response. What's happening here is that the response is presented to us as a stream. We could read this stream manually if we wanted to, via ",{"type":20,"tag":68,"props":4860,"children":4862},{"className":4861},[],[4863],{"type":30,"value":4864},"response.body.getReader()",{"type":30,"value":4866},", but for most purposes, we can rely on one of the built in readers: ",{"type":20,"tag":68,"props":4868,"children":4870},{"className":4869},[],[4871],{"type":30,"value":30},{"type":30,"value":414},{"type":20,"tag":68,"props":4874,"children":4876},{"className":4875},[],[4877],{"type":30,"value":4701},{"type":30,"value":414},{"type":20,"tag":68,"props":4880,"children":4882},{"className":4881},[],[4883],{"type":30,"value":4884},"formData",{"type":30,"value":414},{"type":20,"tag":68,"props":4887,"children":4889},{"className":4888},[],[4890],{"type":30,"value":4891},"blob",{"type":30,"value":174},{"type":20,"tag":68,"props":4894,"children":4896},{"className":4895},[],[4897],{"type":30,"value":4898},"arrayBuffer",{"type":30,"value":4900},". These readers drain the stream and return the value decoded as one might expect in the form of the specified reader - i.e. using the blob reader on the stream will return its value decoded as a blob object.",{"type":20,"tag":21,"props":4902,"children":4903},{},[4904],{"type":30,"value":4905},"This is neat, because it offers us the opportunity to consider how we want to decode any given return - no hacks on top of responseText here. One gotcha to be mindful of, though, is that the readers do 'drain the stream', as I noted above, so if you were to return the response to a future then block, and attempt to read again, that read would fail. We'll talk more about this point next time.",{"type":20,"tag":35,"props":4907,"children":4909},{"id":4908},"response-request",[4910],{"type":30,"value":4911},"Response & Request",{"type":20,"tag":21,"props":4913,"children":4914},{},[4915,4917,4922,4923,4929,4931,4937,4938,4944],{"type":30,"value":4916},"Another nicety of the Fetch api is that we finally gain access to the ",{"type":20,"tag":68,"props":4918,"children":4920},{"className":4919},[],[4921],{"type":30,"value":1228},{"type":30,"value":174},{"type":20,"tag":68,"props":4924,"children":4926},{"className":4925},[],[4927],{"type":30,"value":4928},"Request",{"type":30,"value":4930}," primitives that underlie these requests, allowing us to form our own ",{"type":20,"tag":25,"props":4932,"children":4935},{"href":4933,"rel":4934},"https://developer.mozilla.org/en-US/docs/Web/API/Response",[50],[4936],{"type":30,"value":1228},{"type":30,"value":174},{"type":20,"tag":25,"props":4939,"children":4942},{"href":4940,"rel":4941},"https://developer.mozilla.org/en-US/docs/Web/API/Request",[50],[4943],{"type":30,"value":4928},{"type":30,"value":4945}," objects. This isn't likely to come up very often (especially outside of the context of a web worker), but we'll also be taking a look at how we can use the Response object to produce our own streamable response from cached values next time.",{"type":20,"tag":35,"props":4947,"children":4949},{"id":4948},"gotchas",[4950],{"type":30,"value":4951},"Gotchas",{"type":20,"tag":21,"props":4953,"children":4954},{},[4955],{"type":30,"value":4956},"One of the differences between XMLHttpRequest (and thus $.ajax), and fetch is that network returns that indicate failure, like a 400 or 500 response, won't be considered errors by your fetch promise - if you want them to be errors that are handled in the catch block, you'll want to check for them and throw them yourself:",{"type":20,"tag":184,"props":4958,"children":4960},{"className":186,"code":4959,"language":188,"meta":8,"style":8},"fetch('//jsonplaceholder.typicode.com/users', {\n    method:'GET',\n    credentials:'omit',\n    headers:{\n        'Content-Type': 'application/json'\n    },\n    mode:'cors',\n    cache:'no-cache',\n    referrer:'no-referrer'\n}).then((response) => {\n    let status = response.status;\n\n    if (status \u003C 200 || status > 299) throw new Error(status);\n\n}).catch((error) => {\n    // Catch our network error here\n});\n",[4961],{"type":20,"tag":68,"props":4962,"children":4963},{"__ignoreMap":8},[4964,4983,4998,5015,5023,5041,5049,5066,5083,5096,5127,5149,5156,5219,5226,5257,5265],{"type":20,"tag":194,"props":4965,"children":4966},{"class":196,"line":197},[4967,4971,4975,4979],{"type":20,"tag":194,"props":4968,"children":4969},{"style":258},[4970],{"type":30,"value":1332},{"type":20,"tag":194,"props":4972,"children":4973},{"style":264},[4974],{"type":30,"value":403},{"type":20,"tag":194,"props":4976,"children":4977},{"style":506},[4978],{"type":30,"value":4343},{"type":20,"tag":194,"props":4980,"children":4981},{"style":264},[4982],{"type":30,"value":4641},{"type":20,"tag":194,"props":4984,"children":4985},{"class":196,"line":207},[4986,4990,4994],{"type":20,"tag":194,"props":4987,"children":4988},{"style":264},[4989],{"type":30,"value":4649},{"type":20,"tag":194,"props":4991,"children":4992},{"style":506},[4993],{"type":30,"value":4450},{"type":20,"tag":194,"props":4995,"children":4996},{"style":264},[4997],{"type":30,"value":1075},{"type":20,"tag":194,"props":4999,"children":5000},{"class":196,"line":216},[5001,5006,5011],{"type":20,"tag":194,"props":5002,"children":5003},{"style":264},[5004],{"type":30,"value":5005},"    credentials:",{"type":20,"tag":194,"props":5007,"children":5008},{"style":506},[5009],{"type":30,"value":5010},"'omit'",{"type":20,"tag":194,"props":5012,"children":5013},{"style":264},[5014],{"type":30,"value":1075},{"type":20,"tag":194,"props":5016,"children":5017},{"class":196,"line":225},[5018],{"type":20,"tag":194,"props":5019,"children":5020},{"style":264},[5021],{"type":30,"value":5022},"    headers:{\n",{"type":20,"tag":194,"props":5024,"children":5025},{"class":196,"line":234},[5026,5031,5036],{"type":20,"tag":194,"props":5027,"children":5028},{"style":506},[5029],{"type":30,"value":5030},"        'Content-Type'",{"type":20,"tag":194,"props":5032,"children":5033},{"style":264},[5034],{"type":30,"value":5035},": ",{"type":20,"tag":194,"props":5037,"children":5038},{"style":506},[5039],{"type":30,"value":5040},"'application/json'\n",{"type":20,"tag":194,"props":5042,"children":5043},{"class":196,"line":243},[5044],{"type":20,"tag":194,"props":5045,"children":5046},{"style":264},[5047],{"type":30,"value":5048},"    },\n",{"type":20,"tag":194,"props":5050,"children":5051},{"class":196,"line":275},[5052,5057,5062],{"type":20,"tag":194,"props":5053,"children":5054},{"style":264},[5055],{"type":30,"value":5056},"    mode:",{"type":20,"tag":194,"props":5058,"children":5059},{"style":506},[5060],{"type":30,"value":5061},"'cors'",{"type":20,"tag":194,"props":5063,"children":5064},{"style":264},[5065],{"type":30,"value":1075},{"type":20,"tag":194,"props":5067,"children":5068},{"class":196,"line":284},[5069,5074,5079],{"type":20,"tag":194,"props":5070,"children":5071},{"style":264},[5072],{"type":30,"value":5073},"    cache:",{"type":20,"tag":194,"props":5075,"children":5076},{"style":506},[5077],{"type":30,"value":5078},"'no-cache'",{"type":20,"tag":194,"props":5080,"children":5081},{"style":264},[5082],{"type":30,"value":1075},{"type":20,"tag":194,"props":5084,"children":5085},{"class":196,"line":311},[5086,5091],{"type":20,"tag":194,"props":5087,"children":5088},{"style":264},[5089],{"type":30,"value":5090},"    referrer:",{"type":20,"tag":194,"props":5092,"children":5093},{"style":506},[5094],{"type":30,"value":5095},"'no-referrer'\n",{"type":20,"tag":194,"props":5097,"children":5098},{"class":196,"line":320},[5099,5103,5107,5111,5115,5119,5123],{"type":20,"tag":194,"props":5100,"children":5101},{"style":264},[5102],{"type":30,"value":4491},{"type":20,"tag":194,"props":5104,"children":5105},{"style":258},[5106],{"type":30,"value":572},{"type":20,"tag":194,"props":5108,"children":5109},{"style":264},[5110],{"type":30,"value":577},{"type":20,"tag":194,"props":5112,"children":5113},{"style":406},[5114],{"type":30,"value":437},{"type":20,"tag":194,"props":5116,"children":5117},{"style":264},[5118],{"type":30,"value":514},{"type":20,"tag":194,"props":5120,"children":5121},{"style":252},[5122],{"type":30,"value":590},{"type":20,"tag":194,"props":5124,"children":5125},{"style":264},[5126],{"type":30,"value":595},{"type":20,"tag":194,"props":5128,"children":5129},{"class":196,"line":347},[5130,5135,5140,5144],{"type":20,"tag":194,"props":5131,"children":5132},{"style":252},[5133],{"type":30,"value":5134},"    let",{"type":20,"tag":194,"props":5136,"children":5137},{"style":264},[5138],{"type":30,"value":5139}," status ",{"type":20,"tag":194,"props":5141,"children":5142},{"style":252},[5143],{"type":30,"value":461},{"type":20,"tag":194,"props":5145,"children":5146},{"style":264},[5147],{"type":30,"value":5148}," response.status;\n",{"type":20,"tag":194,"props":5150,"children":5151},{"class":196,"line":356},[5152],{"type":20,"tag":194,"props":5153,"children":5154},{"emptyLinePlaceholder":546},[5155],{"type":30,"value":549},{"type":20,"tag":194,"props":5157,"children":5158},{"class":196,"line":378},[5159,5163,5168,5172,5177,5182,5186,5191,5196,5200,5205,5209,5214],{"type":20,"tag":194,"props":5160,"children":5161},{"style":252},[5162],{"type":30,"value":1360},{"type":20,"tag":194,"props":5164,"children":5165},{"style":264},[5166],{"type":30,"value":5167}," (status ",{"type":20,"tag":194,"props":5169,"children":5170},{"style":252},[5171],{"type":30,"value":3674},{"type":20,"tag":194,"props":5173,"children":5174},{"style":680},[5175],{"type":30,"value":5176}," 200",{"type":20,"tag":194,"props":5178,"children":5179},{"style":252},[5180],{"type":30,"value":5181}," ||",{"type":20,"tag":194,"props":5183,"children":5184},{"style":264},[5185],{"type":30,"value":5139},{"type":20,"tag":194,"props":5187,"children":5188},{"style":252},[5189],{"type":30,"value":5190},">",{"type":20,"tag":194,"props":5192,"children":5193},{"style":680},[5194],{"type":30,"value":5195}," 299",{"type":20,"tag":194,"props":5197,"children":5198},{"style":264},[5199],{"type":30,"value":514},{"type":20,"tag":194,"props":5201,"children":5202},{"style":252},[5203],{"type":30,"value":5204},"throw",{"type":20,"tag":194,"props":5206,"children":5207},{"style":252},[5208],{"type":30,"value":1031},{"type":20,"tag":194,"props":5210,"children":5211},{"style":258},[5212],{"type":30,"value":5213}," Error",{"type":20,"tag":194,"props":5215,"children":5216},{"style":264},[5217],{"type":30,"value":5218},"(status);\n",{"type":20,"tag":194,"props":5220,"children":5221},{"class":196,"line":387},[5222],{"type":20,"tag":194,"props":5223,"children":5224},{"emptyLinePlaceholder":546},[5225],{"type":30,"value":549},{"type":20,"tag":194,"props":5227,"children":5228},{"class":196,"line":445},[5229,5233,5237,5241,5245,5249,5253],{"type":20,"tag":194,"props":5230,"children":5231},{"style":264},[5232],{"type":30,"value":4491},{"type":20,"tag":194,"props":5234,"children":5235},{"style":258},[5236],{"type":30,"value":754},{"type":20,"tag":194,"props":5238,"children":5239},{"style":264},[5240],{"type":30,"value":577},{"type":20,"tag":194,"props":5242,"children":5243},{"style":406},[5244],{"type":30,"value":4398},{"type":20,"tag":194,"props":5246,"children":5247},{"style":264},[5248],{"type":30,"value":514},{"type":20,"tag":194,"props":5250,"children":5251},{"style":252},[5252],{"type":30,"value":590},{"type":20,"tag":194,"props":5254,"children":5255},{"style":264},[5256],{"type":30,"value":595},{"type":20,"tag":194,"props":5258,"children":5259},{"class":196,"line":479},[5260],{"type":20,"tag":194,"props":5261,"children":5262},{"style":201},[5263],{"type":30,"value":5264},"    // Catch our network error here\n",{"type":20,"tag":194,"props":5266,"children":5267},{"class":196,"line":542},[5268],{"type":20,"tag":194,"props":5269,"children":5270},{"style":264},[5271],{"type":30,"value":4204},{"type":20,"tag":21,"props":5273,"children":5274},{},[5275,5277,5283],{"type":30,"value":5276},"You'll notice I also included a more comprehensive settings object this time. For the details on all the possible settings, I suggest checking out the links in the further reading section, below. For now, the one we really need to talk about is the ",{"type":20,"tag":68,"props":5278,"children":5280},{"className":5279},[],[5281],{"type":30,"value":5282},"credentials",{"type":30,"value":5284}," property.",{"type":20,"tag":21,"props":5286,"children":5287},{},[5288,5290,5296],{"type":30,"value":5289},"By default, XMLHttpRequest will send credentials to requests on the same-origin. Not so for fetch - 'omit' is the default value for credentials, so if you need to send cookies up to your server to authenticate a request, for instance, you'll need to be sure to specify ",{"type":20,"tag":68,"props":5291,"children":5293},{"className":5292},[],[5294],{"type":30,"value":5295},"credentials:'include'",{"type":30,"value":5297}," instead.",{"type":20,"tag":21,"props":5299,"children":5300},{},[5301],{"type":30,"value":5302},"Finally, at the moment there's no way to cancel a fetch request (this is in the works, and will probably coincide with being able to cancel a Promise), there's no progress events as there are in the XHR2 spec (although you can build your own, should you be so inclined), and there's no option for synchronous requests (which is good, and sync requests are deprecated and going to disappear in XHR at some future point as well).",{"type":20,"tag":21,"props":5304,"children":5305},{},[5306],{"type":30,"value":5307},"These potential gotchas are the usual cost of being on the sharp edge of emerging tech, and many will likely be smoothed over by browser developers or libraries that wrap the fetch functionality.",{"type":20,"tag":35,"props":5309,"children":5311},{"id":5310},"next-time",[5312],{"type":30,"value":5313},"Next Time",{"type":20,"tag":21,"props":5315,"children":5316},{},[5317],{"type":30,"value":5318},"Speaking of libraries that wrap the Fetch functionality, as I've been hinting, next time we'll take a deeper look into actually using the Fetch API, and present and dissect a library that will allow us to cache responses we've retrieved with fetch for bandwidth savings and offline usage. Stay tuned.",{"type":20,"tag":35,"props":5320,"children":5322},{"id":5321},"further-reading",[5323],{"type":30,"value":5324},"Further Reading",{"type":20,"tag":5326,"props":5327,"children":5328},"ul",{},[5329,5339,5349],{"type":20,"tag":5330,"props":5331,"children":5332},"li",{},[5333],{"type":20,"tag":25,"props":5334,"children":5336},{"href":4014,"rel":5335},[50],[5337],{"type":30,"value":5338},"Fetch API",{"type":20,"tag":5330,"props":5340,"children":5341},{},[5342],{"type":20,"tag":25,"props":5343,"children":5346},{"href":5344,"rel":5345},"https://developers.google.com/web/updates/2015/03/introduction-to-fetch?hl=en",[50],[5347],{"type":30,"value":5348},"Introduction to fetch",{"type":20,"tag":5330,"props":5350,"children":5351},{},[5352],{"type":20,"tag":25,"props":5353,"children":5356},{"href":5354,"rel":5355},"https://jakearchibald.com/2015/thats-so-fetch/",[50],[5357],{"type":30,"value":5358},"That's so fetch",{"type":20,"tag":3951,"props":5360,"children":5361},{},[5362],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":5364},[5365,5366,5367,5368,5369,5370],{"id":4027,"depth":216,"text":4030},{"id":4843,"depth":216,"text":4846},{"id":4908,"depth":216,"text":4911},{"id":4948,"depth":216,"text":4951},{"id":5310,"depth":216,"text":5313},{"id":5321,"depth":216,"text":5324},"content:ckeefer:2016-6:goFetch1.md","ckeefer/2016-6/goFetch1.md","ckeefer/2016-6/goFetch1",{"user":3970,"name":3971},{"_path":5376,"_dir":5377,"_draft":7,"_partial":7,"_locale":8,"title":5378,"description":5379,"publishDate":5380,"tags":5381,"excerpt":5379,"body":5384,"_type":3963,"_id":8717,"_source":3965,"_file":8718,"_stem":8719,"_extension":3968,"author":8720},"/ckeefer/2016-2/paymentprocessing","2016-2","Payment Processing with Braintree","You've built the web application of the century, and the users have rightly flooded to it. Cat pictures for everyone!","2016-05-11",[5382,13,14,5383],"django","python",{"type":17,"children":5385,"toc":8710},[5386,5390,5395,5407,5419,5433,5473,5478,5484,5504,5509,5516,5555,5560,5710,5724,5969,5989,5994,6223,6229,6261,6283,6613,6618,6631,6808,6813,6818,6827,6833,6855,7602,7608,7621,8652,8658,8663,8675,8687,8692,8706],{"type":20,"tag":21,"props":5387,"children":5388},{},[5389],{"type":30,"value":5379},{"type":20,"tag":21,"props":5391,"children":5392},{},[5393],{"type":30,"value":5394},"But alas, while your users indulge in cat-induced bliss, the cold hard reality of server costs cannot help but harsh your mellow. What is to be done?",{"type":20,"tag":21,"props":5396,"children":5397},{},[5398,5400,5405],{"type":30,"value":5399},"Maybe, you could get the users to... ",{"type":20,"tag":4379,"props":5401,"children":5402},{},[5403],{"type":30,"value":5404},"pay",{"type":30,"value":5406}," for access to your incredible web application in all its multivarious splendour?",{"type":20,"tag":21,"props":5408,"children":5409},{},[5410,5417],{"type":20,"tag":25,"props":5411,"children":5414},{"href":5412,"rel":5413},"https://www.braintreepayments.com/",[50],[5415],{"type":30,"value":5416},"Braintree",{"type":30,"value":5418}," is a payment processor (now a subsidiary of PayPal), which boasts of a \"simple, robust way to accept payments\", and with features like a drop-in payment ui and libraries for various programming languages enabling fairly easy integration, is a solid choice for accepting payments via credit card or PayPal.",{"type":20,"tag":21,"props":5420,"children":5421},{},[5422,5424,5431],{"type":30,"value":5423},"While Braintree's ",{"type":20,"tag":25,"props":5425,"children":5428},{"href":5426,"rel":5427},"https://developers.braintreepayments.com/",[50],[5429],{"type":30,"value":5430},"developer documentation",{"type":30,"value":5432}," is blessedly detailed, it's possessed of a potentially confusing bevy of options, and its various implementation examples are spread out amongst a number of pages and platforms. So today, rather than reiterate any particular section of the docs, we're going to take a look at an end-to-end example of a specific, straightforward scenario - accepting and processing a one-time, immediately settled payment in a web application.",{"type":20,"tag":21,"props":5434,"children":5435},{},[5436,5438,5445,5447,5454,5456,5463,5464,5471],{"type":30,"value":5437},"Our languages of choice for today will be ",{"type":20,"tag":25,"props":5439,"children":5442},{"href":5440,"rel":5441},"https://developers.braintreepayments.com/start/hello-server/python",[50],[5443],{"type":30,"value":5444},"Python",{"type":30,"value":5446}," for the backend and, of course, ",{"type":20,"tag":25,"props":5448,"children":5451},{"href":5449,"rel":5450},"https://developers.braintreepayments.com/start/hello-client/javascript",[50],[5452],{"type":30,"value":5453},"JavaScript",{"type":30,"value":5455}," for the frontend, with the additional assumption of jQuery for the ease of $.ajax. The general logic for the backend will be portable to the other languages for which Braintree has released an SDK, e.g. ",{"type":20,"tag":25,"props":5457,"children":5460},{"href":5458,"rel":5459},"https://developers.braintreepayments.com/start/hello-server/ruby",[50],[5461],{"type":30,"value":5462},"Ruby",{"type":30,"value":414},{"type":20,"tag":25,"props":5465,"children":5468},{"href":5466,"rel":5467},"https://developers.braintreepayments.com/start/hello-server/php",[50],[5469],{"type":30,"value":5470},"PHP",{"type":30,"value":5472},", etc., and the frontend logic could certainly be implemented without jQuery.",{"type":20,"tag":21,"props":5474,"children":5475},{},[5476],{"type":30,"value":5477},"We're also going to assume the existence of a database for storing and retrieving item and transaction details. We're also going to assume the use of Django as our web framework in the following examples, but the general concepts are portable to other frameworks.",{"type":20,"tag":4037,"props":5479,"children":5481},{"id":5480},"not-production-ready",[5482],{"type":30,"value":5483},"Not Production Ready",{"type":20,"tag":21,"props":5485,"children":5486},{},[5487,5489,5495,5497,5502],{"type":30,"value":5488},"One more important note before we get started - the code below should ",{"type":20,"tag":5490,"props":5491,"children":5492},"strong",{},[5493],{"type":30,"value":5494},"not",{"type":30,"value":5496}," be considered production ready. It is example-quality, meant for instructional purposes only! While it should go without saying that copy-pasting code is always a bad idea, copy-pasting example code for business critical purposes like payment processing is a big enough no-no to warrant an extra paragraph warning everyone against it. ",{"type":20,"tag":4379,"props":5498,"children":5499},{},[5500],{"type":30,"value":5501},"This is that paragraph.",{"type":30,"value":5503}," Copy-pasting == bad. Using this tutorial to learn == good.",{"type":20,"tag":21,"props":5505,"children":5506},{},[5507],{"type":30,"value":5508},"With that established, let's get started.",{"type":20,"tag":5510,"props":5511,"children":5513},"h2",{"id":5512},"server-setup-and-token-generation",[5514],{"type":30,"value":5515},"Server Setup and Token Generation",{"type":20,"tag":21,"props":5517,"children":5518},{},[5519,5521,5528,5530,5537,5538,5544,5546,5553],{"type":30,"value":5520},"After ",{"type":20,"tag":25,"props":5522,"children":5525},{"href":5523,"rel":5524},"https://www.braintreepayments.com/get-started",[50],[5526],{"type":30,"value":5527},"signing up for a sandbox account",{"type":30,"value":5529}," and doing some basic setup in the ",{"type":20,"tag":25,"props":5531,"children":5534},{"href":5532,"rel":5533},"https://articles.braintreepayments.com/control-panel/basics/overview",[50],[5535],{"type":30,"value":5536},"braintree control panel",{"type":30,"value":414},{"type":20,"tag":25,"props":5539,"children":5541},{"href":5440,"rel":5540},[50],[5542],{"type":30,"value":5543},"our first step",{"type":30,"value":5545}," is to install the ",{"type":20,"tag":25,"props":5547,"children":5550},{"href":5548,"rel":5549},"https://pypi.python.org/pypi/braintree/3.25.0",[50],[5551],{"type":30,"value":5552},"Braintree Python Library",{"type":30,"value":5554},", manually or via pip.",{"type":20,"tag":21,"props":5556,"children":5557},{},[5558],{"type":30,"value":5559},"That done, we'll want to store our configuration details somewhere. In Django we might perform our configuration in settings.py:",{"type":20,"tag":184,"props":5561,"children":5564},{"className":5562,"code":5563,"language":5383,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","import os\nimport braintree\n\nbraintree.Configuration.configure(\n    os.environ.get('BT_ENVIRONMENT', braintree.Environment.Sandbox),\n    os.environ.get('BT_MERCHANT_ID', 'your_sandbox_merchant_id'),\n    os.environ.get('BT_PUBLIC_KEY', 'your_sandbox_public_key'),\n    os.environ.get('BT_PRIVATE_KEY', 'your_sandbox_private_key')\n)\n",[5565],{"type":20,"tag":68,"props":5566,"children":5567},{"__ignoreMap":8},[5568,5581,5593,5600,5608,5626,5652,5677,5703],{"type":20,"tag":194,"props":5569,"children":5570},{"class":196,"line":197},[5571,5576],{"type":20,"tag":194,"props":5572,"children":5573},{"style":252},[5574],{"type":30,"value":5575},"import",{"type":20,"tag":194,"props":5577,"children":5578},{"style":264},[5579],{"type":30,"value":5580}," os\n",{"type":20,"tag":194,"props":5582,"children":5583},{"class":196,"line":207},[5584,5588],{"type":20,"tag":194,"props":5585,"children":5586},{"style":252},[5587],{"type":30,"value":5575},{"type":20,"tag":194,"props":5589,"children":5590},{"style":264},[5591],{"type":30,"value":5592}," braintree\n",{"type":20,"tag":194,"props":5594,"children":5595},{"class":196,"line":216},[5596],{"type":20,"tag":194,"props":5597,"children":5598},{"emptyLinePlaceholder":546},[5599],{"type":30,"value":549},{"type":20,"tag":194,"props":5601,"children":5602},{"class":196,"line":225},[5603],{"type":20,"tag":194,"props":5604,"children":5605},{"style":264},[5606],{"type":30,"value":5607},"braintree.Configuration.configure(\n",{"type":20,"tag":194,"props":5609,"children":5610},{"class":196,"line":234},[5611,5616,5621],{"type":20,"tag":194,"props":5612,"children":5613},{"style":264},[5614],{"type":30,"value":5615},"    os.environ.get(",{"type":20,"tag":194,"props":5617,"children":5618},{"style":506},[5619],{"type":30,"value":5620},"'BT_ENVIRONMENT'",{"type":20,"tag":194,"props":5622,"children":5623},{"style":264},[5624],{"type":30,"value":5625},", braintree.Environment.Sandbox),\n",{"type":20,"tag":194,"props":5627,"children":5628},{"class":196,"line":243},[5629,5633,5638,5642,5647],{"type":20,"tag":194,"props":5630,"children":5631},{"style":264},[5632],{"type":30,"value":5615},{"type":20,"tag":194,"props":5634,"children":5635},{"style":506},[5636],{"type":30,"value":5637},"'BT_MERCHANT_ID'",{"type":20,"tag":194,"props":5639,"children":5640},{"style":264},[5641],{"type":30,"value":414},{"type":20,"tag":194,"props":5643,"children":5644},{"style":506},[5645],{"type":30,"value":5646},"'your_sandbox_merchant_id'",{"type":20,"tag":194,"props":5648,"children":5649},{"style":264},[5650],{"type":30,"value":5651},"),\n",{"type":20,"tag":194,"props":5653,"children":5654},{"class":196,"line":275},[5655,5659,5664,5668,5673],{"type":20,"tag":194,"props":5656,"children":5657},{"style":264},[5658],{"type":30,"value":5615},{"type":20,"tag":194,"props":5660,"children":5661},{"style":506},[5662],{"type":30,"value":5663},"'BT_PUBLIC_KEY'",{"type":20,"tag":194,"props":5665,"children":5666},{"style":264},[5667],{"type":30,"value":414},{"type":20,"tag":194,"props":5669,"children":5670},{"style":506},[5671],{"type":30,"value":5672},"'your_sandbox_public_key'",{"type":20,"tag":194,"props":5674,"children":5675},{"style":264},[5676],{"type":30,"value":5651},{"type":20,"tag":194,"props":5678,"children":5679},{"class":196,"line":284},[5680,5684,5689,5693,5698],{"type":20,"tag":194,"props":5681,"children":5682},{"style":264},[5683],{"type":30,"value":5615},{"type":20,"tag":194,"props":5685,"children":5686},{"style":506},[5687],{"type":30,"value":5688},"'BT_PRIVATE_KEY'",{"type":20,"tag":194,"props":5690,"children":5691},{"style":264},[5692],{"type":30,"value":414},{"type":20,"tag":194,"props":5694,"children":5695},{"style":506},[5696],{"type":30,"value":5697},"'your_sandbox_private_key'",{"type":20,"tag":194,"props":5699,"children":5700},{"style":264},[5701],{"type":30,"value":5702},")\n",{"type":20,"tag":194,"props":5704,"children":5705},{"class":196,"line":311},[5706],{"type":20,"tag":194,"props":5707,"children":5708},{"style":264},[5709],{"type":30,"value":5702},{"type":20,"tag":21,"props":5711,"children":5712},{},[5713,5715,5722],{"type":30,"value":5714},"Next, we need to setup an endpoint for the client to request a ",{"type":20,"tag":25,"props":5716,"children":5719},{"href":5717,"rel":5718},"https://developers.braintreepayments.com/start/hello-server/python#generate-a-client-token",[50],[5720],{"type":30,"value":5721},"client token",{"type":30,"value":5723}," from:",{"type":20,"tag":184,"props":5725,"children":5727},{"className":5562,"code":5726,"language":5383,"meta":8,"style":8},"import braintree\nfrom django.http import JsonResponse\nfrom django.views.decorators.http import require_http_methods\n\n@require_http_methods(['GET'])\ndef get_braintree_client_token(request):\n    \"\"\"\n    Generate and return client token.\n    \"\"\"\n    try:\n        client_token = braintree.ClientToken.generate()\n    except ValueError as e:\n        return JsonResponse({\"error\": e.message}, status=500)\n    return JsonResponse({\"token\": client_token})\n",[5728],{"type":20,"tag":68,"props":5729,"children":5730},{"__ignoreMap":8},[5731,5742,5764,5785,5792,5814,5832,5840,5848,5855,5868,5885,5908,5948],{"type":20,"tag":194,"props":5732,"children":5733},{"class":196,"line":197},[5734,5738],{"type":20,"tag":194,"props":5735,"children":5736},{"style":252},[5737],{"type":30,"value":5575},{"type":20,"tag":194,"props":5739,"children":5740},{"style":264},[5741],{"type":30,"value":5592},{"type":20,"tag":194,"props":5743,"children":5744},{"class":196,"line":207},[5745,5750,5755,5759],{"type":20,"tag":194,"props":5746,"children":5747},{"style":252},[5748],{"type":30,"value":5749},"from",{"type":20,"tag":194,"props":5751,"children":5752},{"style":264},[5753],{"type":30,"value":5754}," django.http ",{"type":20,"tag":194,"props":5756,"children":5757},{"style":252},[5758],{"type":30,"value":5575},{"type":20,"tag":194,"props":5760,"children":5761},{"style":264},[5762],{"type":30,"value":5763}," JsonResponse\n",{"type":20,"tag":194,"props":5765,"children":5766},{"class":196,"line":216},[5767,5771,5776,5780],{"type":20,"tag":194,"props":5768,"children":5769},{"style":252},[5770],{"type":30,"value":5749},{"type":20,"tag":194,"props":5772,"children":5773},{"style":264},[5774],{"type":30,"value":5775}," django.views.decorators.http ",{"type":20,"tag":194,"props":5777,"children":5778},{"style":252},[5779],{"type":30,"value":5575},{"type":20,"tag":194,"props":5781,"children":5782},{"style":264},[5783],{"type":30,"value":5784}," require_http_methods\n",{"type":20,"tag":194,"props":5786,"children":5787},{"class":196,"line":225},[5788],{"type":20,"tag":194,"props":5789,"children":5790},{"emptyLinePlaceholder":546},[5791],{"type":30,"value":549},{"type":20,"tag":194,"props":5793,"children":5794},{"class":196,"line":234},[5795,5800,5805,5809],{"type":20,"tag":194,"props":5796,"children":5797},{"style":258},[5798],{"type":30,"value":5799},"@require_http_methods",{"type":20,"tag":194,"props":5801,"children":5802},{"style":264},[5803],{"type":30,"value":5804},"([",{"type":20,"tag":194,"props":5806,"children":5807},{"style":506},[5808],{"type":30,"value":4450},{"type":20,"tag":194,"props":5810,"children":5811},{"style":264},[5812],{"type":30,"value":5813},"])\n",{"type":20,"tag":194,"props":5815,"children":5816},{"class":196,"line":243},[5817,5822,5827],{"type":20,"tag":194,"props":5818,"children":5819},{"style":252},[5820],{"type":30,"value":5821},"def",{"type":20,"tag":194,"props":5823,"children":5824},{"style":258},[5825],{"type":30,"value":5826}," get_braintree_client_token",{"type":20,"tag":194,"props":5828,"children":5829},{"style":264},[5830],{"type":30,"value":5831},"(request):\n",{"type":20,"tag":194,"props":5833,"children":5834},{"class":196,"line":275},[5835],{"type":20,"tag":194,"props":5836,"children":5837},{"style":506},[5838],{"type":30,"value":5839},"    \"\"\"\n",{"type":20,"tag":194,"props":5841,"children":5842},{"class":196,"line":284},[5843],{"type":20,"tag":194,"props":5844,"children":5845},{"style":506},[5846],{"type":30,"value":5847},"    Generate and return client token.\n",{"type":20,"tag":194,"props":5849,"children":5850},{"class":196,"line":311},[5851],{"type":20,"tag":194,"props":5852,"children":5853},{"style":506},[5854],{"type":30,"value":5839},{"type":20,"tag":194,"props":5856,"children":5857},{"class":196,"line":320},[5858,5863],{"type":20,"tag":194,"props":5859,"children":5860},{"style":252},[5861],{"type":30,"value":5862},"    try",{"type":20,"tag":194,"props":5864,"children":5865},{"style":264},[5866],{"type":30,"value":5867},":\n",{"type":20,"tag":194,"props":5869,"children":5870},{"class":196,"line":347},[5871,5876,5880],{"type":20,"tag":194,"props":5872,"children":5873},{"style":264},[5874],{"type":30,"value":5875},"        client_token ",{"type":20,"tag":194,"props":5877,"children":5878},{"style":252},[5879],{"type":30,"value":461},{"type":20,"tag":194,"props":5881,"children":5882},{"style":264},[5883],{"type":30,"value":5884}," braintree.ClientToken.generate()\n",{"type":20,"tag":194,"props":5886,"children":5887},{"class":196,"line":356},[5888,5893,5898,5903],{"type":20,"tag":194,"props":5889,"children":5890},{"style":252},[5891],{"type":30,"value":5892},"    except",{"type":20,"tag":194,"props":5894,"children":5895},{"style":680},[5896],{"type":30,"value":5897}," ValueError",{"type":20,"tag":194,"props":5899,"children":5900},{"style":252},[5901],{"type":30,"value":5902}," as",{"type":20,"tag":194,"props":5904,"children":5905},{"style":264},[5906],{"type":30,"value":5907}," e:\n",{"type":20,"tag":194,"props":5909,"children":5910},{"class":196,"line":378},[5911,5915,5920,5925,5930,5935,5939,5944],{"type":20,"tag":194,"props":5912,"children":5913},{"style":252},[5914],{"type":30,"value":1591},{"type":20,"tag":194,"props":5916,"children":5917},{"style":264},[5918],{"type":30,"value":5919}," JsonResponse({",{"type":20,"tag":194,"props":5921,"children":5922},{"style":506},[5923],{"type":30,"value":5924},"\"error\"",{"type":20,"tag":194,"props":5926,"children":5927},{"style":264},[5928],{"type":30,"value":5929},": e.message}, ",{"type":20,"tag":194,"props":5931,"children":5932},{"style":406},[5933],{"type":30,"value":5934},"status",{"type":20,"tag":194,"props":5936,"children":5937},{"style":252},[5938],{"type":30,"value":461},{"type":20,"tag":194,"props":5940,"children":5941},{"style":680},[5942],{"type":30,"value":5943},"500",{"type":20,"tag":194,"props":5945,"children":5946},{"style":264},[5947],{"type":30,"value":5702},{"type":20,"tag":194,"props":5949,"children":5950},{"class":196,"line":387},[5951,5955,5959,5964],{"type":20,"tag":194,"props":5952,"children":5953},{"style":252},[5954],{"type":30,"value":850},{"type":20,"tag":194,"props":5956,"children":5957},{"style":264},[5958],{"type":30,"value":5919},{"type":20,"tag":194,"props":5960,"children":5961},{"style":506},[5962],{"type":30,"value":5963},"\"token\"",{"type":20,"tag":194,"props":5965,"children":5966},{"style":264},[5967],{"type":30,"value":5968},": client_token})\n",{"type":20,"tag":21,"props":5970,"children":5971},{},[5972,5974,5980,5982,5988],{"type":30,"value":5973},"For Django, we can add this to a reasonable route in our ",{"type":20,"tag":68,"props":5975,"children":5977},{"className":5976},[],[5978],{"type":30,"value":5979},"urls.py",{"type":30,"value":5981}," file, and then make ajax requests against this route to generate and return the client token that the javascript braintree library requires. For the purpose of this tutorial, we'll assume we've bound it to ",{"type":20,"tag":68,"props":5983,"children":5985},{"className":5984},[],[5986],{"type":30,"value":5987},"/payment/token/",{"type":30,"value":55},{"type":20,"tag":21,"props":5990,"children":5991},{},[5992],{"type":30,"value":5993},"As an aside, we could also generate this token as part of the view and pass it into the context if we knew we were going to need it immediately, or if there were some other reason why an ajax roundtrip is undesirable. This could be as simple as:",{"type":20,"tag":184,"props":5995,"children":5997},{"className":5562,"code":5996,"language":5383,"meta":8,"style":8},"import braintree\nfrom django.shortcuts import render\nfrom django.http import HttpResponse\n\ndef start_payment_view(request, template_name=\"start_payment.html\"):\n    \"\"\"\n    Generate client token and pass it in the view context.\n    \"\"\"\n    try:\n        client_token = braintree.ClientToken.generate()\n    except ValueError as e:\n        return HttpResponse(\"Failed to generate Braintree client token\", status=500)\n\n    return render(request, template_name, {\"bt_client_token\": client_token})\n",[5998],{"type":20,"tag":68,"props":5999,"children":6000},{"__ignoreMap":8},[6001,6012,6033,6053,6060,6091,6098,6106,6113,6124,6139,6158,6195,6202],{"type":20,"tag":194,"props":6002,"children":6003},{"class":196,"line":197},[6004,6008],{"type":20,"tag":194,"props":6005,"children":6006},{"style":252},[6007],{"type":30,"value":5575},{"type":20,"tag":194,"props":6009,"children":6010},{"style":264},[6011],{"type":30,"value":5592},{"type":20,"tag":194,"props":6013,"children":6014},{"class":196,"line":207},[6015,6019,6024,6028],{"type":20,"tag":194,"props":6016,"children":6017},{"style":252},[6018],{"type":30,"value":5749},{"type":20,"tag":194,"props":6020,"children":6021},{"style":264},[6022],{"type":30,"value":6023}," django.shortcuts ",{"type":20,"tag":194,"props":6025,"children":6026},{"style":252},[6027],{"type":30,"value":5575},{"type":20,"tag":194,"props":6029,"children":6030},{"style":264},[6031],{"type":30,"value":6032}," render\n",{"type":20,"tag":194,"props":6034,"children":6035},{"class":196,"line":216},[6036,6040,6044,6048],{"type":20,"tag":194,"props":6037,"children":6038},{"style":252},[6039],{"type":30,"value":5749},{"type":20,"tag":194,"props":6041,"children":6042},{"style":264},[6043],{"type":30,"value":5754},{"type":20,"tag":194,"props":6045,"children":6046},{"style":252},[6047],{"type":30,"value":5575},{"type":20,"tag":194,"props":6049,"children":6050},{"style":264},[6051],{"type":30,"value":6052}," HttpResponse\n",{"type":20,"tag":194,"props":6054,"children":6055},{"class":196,"line":225},[6056],{"type":20,"tag":194,"props":6057,"children":6058},{"emptyLinePlaceholder":546},[6059],{"type":30,"value":549},{"type":20,"tag":194,"props":6061,"children":6062},{"class":196,"line":234},[6063,6067,6072,6077,6081,6086],{"type":20,"tag":194,"props":6064,"children":6065},{"style":252},[6066],{"type":30,"value":5821},{"type":20,"tag":194,"props":6068,"children":6069},{"style":258},[6070],{"type":30,"value":6071}," start_payment_view",{"type":20,"tag":194,"props":6073,"children":6074},{"style":264},[6075],{"type":30,"value":6076},"(request, template_name",{"type":20,"tag":194,"props":6078,"children":6079},{"style":252},[6080],{"type":30,"value":461},{"type":20,"tag":194,"props":6082,"children":6083},{"style":506},[6084],{"type":30,"value":6085},"\"start_payment.html\"",{"type":20,"tag":194,"props":6087,"children":6088},{"style":264},[6089],{"type":30,"value":6090},"):\n",{"type":20,"tag":194,"props":6092,"children":6093},{"class":196,"line":243},[6094],{"type":20,"tag":194,"props":6095,"children":6096},{"style":506},[6097],{"type":30,"value":5839},{"type":20,"tag":194,"props":6099,"children":6100},{"class":196,"line":275},[6101],{"type":20,"tag":194,"props":6102,"children":6103},{"style":506},[6104],{"type":30,"value":6105},"    Generate client token and pass it in the view context.\n",{"type":20,"tag":194,"props":6107,"children":6108},{"class":196,"line":284},[6109],{"type":20,"tag":194,"props":6110,"children":6111},{"style":506},[6112],{"type":30,"value":5839},{"type":20,"tag":194,"props":6114,"children":6115},{"class":196,"line":311},[6116,6120],{"type":20,"tag":194,"props":6117,"children":6118},{"style":252},[6119],{"type":30,"value":5862},{"type":20,"tag":194,"props":6121,"children":6122},{"style":264},[6123],{"type":30,"value":5867},{"type":20,"tag":194,"props":6125,"children":6126},{"class":196,"line":320},[6127,6131,6135],{"type":20,"tag":194,"props":6128,"children":6129},{"style":264},[6130],{"type":30,"value":5875},{"type":20,"tag":194,"props":6132,"children":6133},{"style":252},[6134],{"type":30,"value":461},{"type":20,"tag":194,"props":6136,"children":6137},{"style":264},[6138],{"type":30,"value":5884},{"type":20,"tag":194,"props":6140,"children":6141},{"class":196,"line":347},[6142,6146,6150,6154],{"type":20,"tag":194,"props":6143,"children":6144},{"style":252},[6145],{"type":30,"value":5892},{"type":20,"tag":194,"props":6147,"children":6148},{"style":680},[6149],{"type":30,"value":5897},{"type":20,"tag":194,"props":6151,"children":6152},{"style":252},[6153],{"type":30,"value":5902},{"type":20,"tag":194,"props":6155,"children":6156},{"style":264},[6157],{"type":30,"value":5907},{"type":20,"tag":194,"props":6159,"children":6160},{"class":196,"line":356},[6161,6165,6170,6175,6179,6183,6187,6191],{"type":20,"tag":194,"props":6162,"children":6163},{"style":252},[6164],{"type":30,"value":1591},{"type":20,"tag":194,"props":6166,"children":6167},{"style":264},[6168],{"type":30,"value":6169}," HttpResponse(",{"type":20,"tag":194,"props":6171,"children":6172},{"style":506},[6173],{"type":30,"value":6174},"\"Failed to generate Braintree client token\"",{"type":20,"tag":194,"props":6176,"children":6177},{"style":264},[6178],{"type":30,"value":414},{"type":20,"tag":194,"props":6180,"children":6181},{"style":406},[6182],{"type":30,"value":5934},{"type":20,"tag":194,"props":6184,"children":6185},{"style":252},[6186],{"type":30,"value":461},{"type":20,"tag":194,"props":6188,"children":6189},{"style":680},[6190],{"type":30,"value":5943},{"type":20,"tag":194,"props":6192,"children":6193},{"style":264},[6194],{"type":30,"value":5702},{"type":20,"tag":194,"props":6196,"children":6197},{"class":196,"line":378},[6198],{"type":20,"tag":194,"props":6199,"children":6200},{"emptyLinePlaceholder":546},[6201],{"type":30,"value":549},{"type":20,"tag":194,"props":6203,"children":6204},{"class":196,"line":387},[6205,6209,6214,6219],{"type":20,"tag":194,"props":6206,"children":6207},{"style":252},[6208],{"type":30,"value":850},{"type":20,"tag":194,"props":6210,"children":6211},{"style":264},[6212],{"type":30,"value":6213}," render(request, template_name, {",{"type":20,"tag":194,"props":6215,"children":6216},{"style":506},[6217],{"type":30,"value":6218},"\"bt_client_token\"",{"type":20,"tag":194,"props":6220,"children":6221},{"style":264},[6222],{"type":30,"value":5968},{"type":20,"tag":5510,"props":6224,"children":6226},{"id":6225},"client-setup",[6227],{"type":30,"value":6228},"Client Setup",{"type":20,"tag":21,"props":6230,"children":6231},{},[6232,6234,6241,6243,6250,6252,6259],{"type":30,"value":6233},"Now for ",{"type":20,"tag":25,"props":6235,"children":6238},{"href":6236,"rel":6237},"https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration",[50],[6239],{"type":30,"value":6240},"client side configuration",{"type":30,"value":6242},". On the client side, we're going to assume we want to use the ",{"type":20,"tag":25,"props":6244,"children":6247},{"href":6245,"rel":6246},"https://developers.braintreepayments.com/guides/drop-in/javascript/v2",[50],[6248],{"type":30,"value":6249},"'Drop-in'",{"type":30,"value":6251}," integration. This generates an iframe hosted by Braintree, allowing our application to qualify for the lowest-effort level of ",{"type":20,"tag":25,"props":6253,"children":6256},{"href":6254,"rel":6255},"https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard",[50],[6257],{"type":30,"value":6258},"PCI Compliance",{"type":30,"value":6260},", while still allowing for a fair amount of customizability, some of which we'll explore shortly.",{"type":20,"tag":21,"props":6262,"children":6263},{},[6264,6266,6273,6275,6281],{"type":30,"value":6265},"Braintree offers a ",{"type":20,"tag":25,"props":6267,"children":6270},{"href":6268,"rel":6269},"https://developers.braintreepayments.com/guides/client-sdk/setup/javascript/v2#install-it-with-npm",[50],[6271],{"type":30,"value":6272},"variety of options",{"type":30,"value":6274}," for integrating the library with your application. For the below, we assume we have a ",{"type":20,"tag":68,"props":6276,"children":6278},{"className":6277},[],[6279],{"type":30,"value":6280},"braintree",{"type":30,"value":6282}," object in global scope:",{"type":20,"tag":184,"props":6284,"children":6286},{"className":186,"code":6285,"language":188,"meta":8,"style":8},"        /**\n         * Request client token and initialize braintree payment library.\n         */\n    setupBraintree:function(){\n        $.ajax({\n            type:'GET',\n            dataType:'json',\n            url:'/payment/token/'\n        }).done(function(res){\n            braintree.setup(res.token, \"dropin\", {\n                container:$('#braintreeContainer')[0],\n                onReady:paymentMethodReady,\n                onPaymentMethodReceived:paymentMethodReceived,\n                onError:paymentMethodError\n            });\n        }.bind(this)).fail(function(jqXHR){\n            console.log(jqXHR, jqXHR.responseJSON || jqXHR.responseText);\n        });\n    }\n",[6287],{"type":20,"tag":68,"props":6288,"children":6289},{"__ignoreMap":8},[6290,6298,6306,6314,6334,6350,6366,6383,6396,6429,6456,6493,6501,6509,6517,6525,6574,6599,6606],{"type":20,"tag":194,"props":6291,"children":6292},{"class":196,"line":197},[6293],{"type":20,"tag":194,"props":6294,"children":6295},{"style":201},[6296],{"type":30,"value":6297},"        /**\n",{"type":20,"tag":194,"props":6299,"children":6300},{"class":196,"line":207},[6301],{"type":20,"tag":194,"props":6302,"children":6303},{"style":201},[6304],{"type":30,"value":6305},"         * Request client token and initialize braintree payment library.\n",{"type":20,"tag":194,"props":6307,"children":6308},{"class":196,"line":216},[6309],{"type":20,"tag":194,"props":6310,"children":6311},{"style":201},[6312],{"type":30,"value":6313},"         */\n",{"type":20,"tag":194,"props":6315,"children":6316},{"class":196,"line":225},[6317,6322,6326,6330],{"type":20,"tag":194,"props":6318,"children":6319},{"style":258},[6320],{"type":30,"value":6321},"    setupBraintree",{"type":20,"tag":194,"props":6323,"children":6324},{"style":264},[6325],{"type":30,"value":1554},{"type":20,"tag":194,"props":6327,"children":6328},{"style":252},[6329],{"type":30,"value":393},{"type":20,"tag":194,"props":6331,"children":6332},{"style":264},[6333],{"type":30,"value":4121},{"type":20,"tag":194,"props":6335,"children":6336},{"class":196,"line":234},[6337,6342,6346],{"type":20,"tag":194,"props":6338,"children":6339},{"style":264},[6340],{"type":30,"value":6341},"        $.",{"type":20,"tag":194,"props":6343,"children":6344},{"style":258},[6345],{"type":30,"value":4432},{"type":20,"tag":194,"props":6347,"children":6348},{"style":264},[6349],{"type":30,"value":4437},{"type":20,"tag":194,"props":6351,"children":6352},{"class":196,"line":243},[6353,6358,6362],{"type":20,"tag":194,"props":6354,"children":6355},{"style":264},[6356],{"type":30,"value":6357},"            type:",{"type":20,"tag":194,"props":6359,"children":6360},{"style":506},[6361],{"type":30,"value":4450},{"type":20,"tag":194,"props":6363,"children":6364},{"style":264},[6365],{"type":30,"value":1075},{"type":20,"tag":194,"props":6367,"children":6368},{"class":196,"line":275},[6369,6374,6379],{"type":20,"tag":194,"props":6370,"children":6371},{"style":264},[6372],{"type":30,"value":6373},"            dataType:",{"type":20,"tag":194,"props":6375,"children":6376},{"style":506},[6377],{"type":30,"value":6378},"'json'",{"type":20,"tag":194,"props":6380,"children":6381},{"style":264},[6382],{"type":30,"value":1075},{"type":20,"tag":194,"props":6384,"children":6385},{"class":196,"line":284},[6386,6391],{"type":20,"tag":194,"props":6387,"children":6388},{"style":264},[6389],{"type":30,"value":6390},"            url:",{"type":20,"tag":194,"props":6392,"children":6393},{"style":506},[6394],{"type":30,"value":6395},"'/payment/token/'\n",{"type":20,"tag":194,"props":6397,"children":6398},{"class":196,"line":311},[6399,6404,6408,6412,6416,6420,6425],{"type":20,"tag":194,"props":6400,"children":6401},{"style":264},[6402],{"type":30,"value":6403},"        }).",{"type":20,"tag":194,"props":6405,"children":6406},{"style":258},[6407],{"type":30,"value":4496},{"type":20,"tag":194,"props":6409,"children":6410},{"style":264},[6411],{"type":30,"value":403},{"type":20,"tag":194,"props":6413,"children":6414},{"style":252},[6415],{"type":30,"value":393},{"type":20,"tag":194,"props":6417,"children":6418},{"style":264},[6419],{"type":30,"value":403},{"type":20,"tag":194,"props":6421,"children":6422},{"style":406},[6423],{"type":30,"value":6424},"res",{"type":20,"tag":194,"props":6426,"children":6427},{"style":264},[6428],{"type":30,"value":4253},{"type":20,"tag":194,"props":6430,"children":6431},{"class":196,"line":320},[6432,6437,6442,6447,6452],{"type":20,"tag":194,"props":6433,"children":6434},{"style":264},[6435],{"type":30,"value":6436},"            braintree.",{"type":20,"tag":194,"props":6438,"children":6439},{"style":258},[6440],{"type":30,"value":6441},"setup",{"type":20,"tag":194,"props":6443,"children":6444},{"style":264},[6445],{"type":30,"value":6446},"(res.token, ",{"type":20,"tag":194,"props":6448,"children":6449},{"style":506},[6450],{"type":30,"value":6451},"\"dropin\"",{"type":20,"tag":194,"props":6453,"children":6454},{"style":264},[6455],{"type":30,"value":4641},{"type":20,"tag":194,"props":6457,"children":6458},{"class":196,"line":347},[6459,6464,6469,6473,6478,6483,6488],{"type":20,"tag":194,"props":6460,"children":6461},{"style":264},[6462],{"type":30,"value":6463},"                container:",{"type":20,"tag":194,"props":6465,"children":6466},{"style":258},[6467],{"type":30,"value":6468},"$",{"type":20,"tag":194,"props":6470,"children":6471},{"style":264},[6472],{"type":30,"value":403},{"type":20,"tag":194,"props":6474,"children":6475},{"style":506},[6476],{"type":30,"value":6477},"'#braintreeContainer'",{"type":20,"tag":194,"props":6479,"children":6480},{"style":264},[6481],{"type":30,"value":6482},")[",{"type":20,"tag":194,"props":6484,"children":6485},{"style":680},[6486],{"type":30,"value":6487},"0",{"type":20,"tag":194,"props":6489,"children":6490},{"style":264},[6491],{"type":30,"value":6492},"],\n",{"type":20,"tag":194,"props":6494,"children":6495},{"class":196,"line":356},[6496],{"type":20,"tag":194,"props":6497,"children":6498},{"style":264},[6499],{"type":30,"value":6500},"                onReady:paymentMethodReady,\n",{"type":20,"tag":194,"props":6502,"children":6503},{"class":196,"line":378},[6504],{"type":20,"tag":194,"props":6505,"children":6506},{"style":264},[6507],{"type":30,"value":6508},"                onPaymentMethodReceived:paymentMethodReceived,\n",{"type":20,"tag":194,"props":6510,"children":6511},{"class":196,"line":387},[6512],{"type":20,"tag":194,"props":6513,"children":6514},{"style":264},[6515],{"type":30,"value":6516},"                onError:paymentMethodError\n",{"type":20,"tag":194,"props":6518,"children":6519},{"class":196,"line":445},[6520],{"type":20,"tag":194,"props":6521,"children":6522},{"style":264},[6523],{"type":30,"value":6524},"            });\n",{"type":20,"tag":194,"props":6526,"children":6527},{"class":196,"line":479},[6528,6533,6537,6541,6545,6550,6554,6558,6562,6566,6570],{"type":20,"tag":194,"props":6529,"children":6530},{"style":264},[6531],{"type":30,"value":6532},"        }.",{"type":20,"tag":194,"props":6534,"children":6535},{"style":258},[6536],{"type":30,"value":3818},{"type":20,"tag":194,"props":6538,"children":6539},{"style":264},[6540],{"type":30,"value":403},{"type":20,"tag":194,"props":6542,"children":6543},{"style":680},[6544],{"type":30,"value":4174},{"type":20,"tag":194,"props":6546,"children":6547},{"style":264},[6548],{"type":30,"value":6549},")).",{"type":20,"tag":194,"props":6551,"children":6552},{"style":258},[6553],{"type":30,"value":4546},{"type":20,"tag":194,"props":6555,"children":6556},{"style":264},[6557],{"type":30,"value":403},{"type":20,"tag":194,"props":6559,"children":6560},{"style":252},[6561],{"type":30,"value":393},{"type":20,"tag":194,"props":6563,"children":6564},{"style":264},[6565],{"type":30,"value":403},{"type":20,"tag":194,"props":6567,"children":6568},{"style":406},[6569],{"type":30,"value":4563},{"type":20,"tag":194,"props":6571,"children":6572},{"style":264},[6573],{"type":30,"value":4253},{"type":20,"tag":194,"props":6575,"children":6576},{"class":196,"line":542},[6577,6581,6585,6590,6594],{"type":20,"tag":194,"props":6578,"children":6579},{"style":264},[6580],{"type":30,"value":791},{"type":20,"tag":194,"props":6582,"children":6583},{"style":258},[6584],{"type":30,"value":796},{"type":20,"tag":194,"props":6586,"children":6587},{"style":264},[6588],{"type":30,"value":6589},"(jqXHR, jqXHR.responseJSON ",{"type":20,"tag":194,"props":6591,"children":6592},{"style":252},[6593],{"type":30,"value":519},{"type":20,"tag":194,"props":6595,"children":6596},{"style":264},[6597],{"type":30,"value":6598}," jqXHR.responseText);\n",{"type":20,"tag":194,"props":6600,"children":6601},{"class":196,"line":552},[6602],{"type":20,"tag":194,"props":6603,"children":6604},{"style":264},[6605],{"type":30,"value":2779},{"type":20,"tag":194,"props":6607,"children":6608},{"class":196,"line":598},[6609],{"type":20,"tag":194,"props":6610,"children":6611},{"style":264},[6612],{"type":30,"value":1657},{"type":20,"tag":21,"props":6614,"children":6615},{},[6616],{"type":30,"value":6617},"Here, we request the client token and, as soon as we've received it from the server, initialize the braintree library, telling it where to place the 'dropin' iframe, and specifying a number of other options, which we'll return to shortly.",{"type":20,"tag":21,"props":6619,"children":6620},{},[6621,6623,6629],{"type":30,"value":6622},"As we need a node for the braintree iframe to live in, which you'll notice in the above code we've given the id of ",{"type":20,"tag":68,"props":6624,"children":6626},{"className":6625},[],[6627],{"type":30,"value":6628},"braintreeContainer",{"type":30,"value":6630},", a sparse example of the markup might look like:",{"type":20,"tag":184,"props":6632,"children":6636},{"className":6633,"code":6634,"language":6635,"meta":8,"style":8},"language-html shiki shiki-themes github-light github-dark","    \u003Cbody>\n\n        \u003Cform>\n            \u003Cdiv id=\"braintreeContainer\">\u003C/div>\n\n            \u003Cbutton type=\"submit\">Pay Now\u003C/button>\n        \u003C/form>\n\n    \u003C/body>\n","html",[6637],{"type":20,"tag":68,"props":6638,"children":6639},{"__ignoreMap":8},[6640,6659,6666,6683,6723,6730,6769,6785,6792],{"type":20,"tag":194,"props":6641,"children":6642},{"class":196,"line":197},[6643,6648,6654],{"type":20,"tag":194,"props":6644,"children":6645},{"style":264},[6646],{"type":30,"value":6647},"    \u003C",{"type":20,"tag":194,"props":6649,"children":6651},{"style":6650},"--shiki-default:#22863A;--shiki-dark:#85E89D",[6652],{"type":30,"value":6653},"body",{"type":20,"tag":194,"props":6655,"children":6656},{"style":264},[6657],{"type":30,"value":6658},">\n",{"type":20,"tag":194,"props":6660,"children":6661},{"class":196,"line":207},[6662],{"type":20,"tag":194,"props":6663,"children":6664},{"emptyLinePlaceholder":546},[6665],{"type":30,"value":549},{"type":20,"tag":194,"props":6667,"children":6668},{"class":196,"line":216},[6669,6674,6679],{"type":20,"tag":194,"props":6670,"children":6671},{"style":264},[6672],{"type":30,"value":6673},"        \u003C",{"type":20,"tag":194,"props":6675,"children":6676},{"style":6650},[6677],{"type":30,"value":6678},"form",{"type":20,"tag":194,"props":6680,"children":6681},{"style":264},[6682],{"type":30,"value":6658},{"type":20,"tag":194,"props":6684,"children":6685},{"class":196,"line":225},[6686,6691,6696,6701,6705,6710,6715,6719],{"type":20,"tag":194,"props":6687,"children":6688},{"style":264},[6689],{"type":30,"value":6690},"            \u003C",{"type":20,"tag":194,"props":6692,"children":6693},{"style":6650},[6694],{"type":30,"value":6695},"div",{"type":20,"tag":194,"props":6697,"children":6698},{"style":258},[6699],{"type":30,"value":6700}," id",{"type":20,"tag":194,"props":6702,"children":6703},{"style":264},[6704],{"type":30,"value":461},{"type":20,"tag":194,"props":6706,"children":6707},{"style":506},[6708],{"type":30,"value":6709},"\"braintreeContainer\"",{"type":20,"tag":194,"props":6711,"children":6712},{"style":264},[6713],{"type":30,"value":6714},">\u003C/",{"type":20,"tag":194,"props":6716,"children":6717},{"style":6650},[6718],{"type":30,"value":6695},{"type":20,"tag":194,"props":6720,"children":6721},{"style":264},[6722],{"type":30,"value":6658},{"type":20,"tag":194,"props":6724,"children":6725},{"class":196,"line":234},[6726],{"type":20,"tag":194,"props":6727,"children":6728},{"emptyLinePlaceholder":546},[6729],{"type":30,"value":549},{"type":20,"tag":194,"props":6731,"children":6732},{"class":196,"line":243},[6733,6737,6742,6747,6751,6756,6761,6765],{"type":20,"tag":194,"props":6734,"children":6735},{"style":264},[6736],{"type":30,"value":6690},{"type":20,"tag":194,"props":6738,"children":6739},{"style":6650},[6740],{"type":30,"value":6741},"button",{"type":20,"tag":194,"props":6743,"children":6744},{"style":258},[6745],{"type":30,"value":6746}," type",{"type":20,"tag":194,"props":6748,"children":6749},{"style":264},[6750],{"type":30,"value":461},{"type":20,"tag":194,"props":6752,"children":6753},{"style":506},[6754],{"type":30,"value":6755},"\"submit\"",{"type":20,"tag":194,"props":6757,"children":6758},{"style":264},[6759],{"type":30,"value":6760},">Pay Now\u003C/",{"type":20,"tag":194,"props":6762,"children":6763},{"style":6650},[6764],{"type":30,"value":6741},{"type":20,"tag":194,"props":6766,"children":6767},{"style":264},[6768],{"type":30,"value":6658},{"type":20,"tag":194,"props":6770,"children":6771},{"class":196,"line":275},[6772,6777,6781],{"type":20,"tag":194,"props":6773,"children":6774},{"style":264},[6775],{"type":30,"value":6776},"        \u003C/",{"type":20,"tag":194,"props":6778,"children":6779},{"style":6650},[6780],{"type":30,"value":6678},{"type":20,"tag":194,"props":6782,"children":6783},{"style":264},[6784],{"type":30,"value":6658},{"type":20,"tag":194,"props":6786,"children":6787},{"class":196,"line":284},[6788],{"type":20,"tag":194,"props":6789,"children":6790},{"emptyLinePlaceholder":546},[6791],{"type":30,"value":549},{"type":20,"tag":194,"props":6793,"children":6794},{"class":196,"line":311},[6795,6800,6804],{"type":20,"tag":194,"props":6796,"children":6797},{"style":264},[6798],{"type":30,"value":6799},"    \u003C/",{"type":20,"tag":194,"props":6801,"children":6802},{"style":6650},[6803],{"type":30,"value":6653},{"type":20,"tag":194,"props":6805,"children":6806},{"style":264},[6807],{"type":30,"value":6658},{"type":20,"tag":21,"props":6809,"children":6810},{},[6811],{"type":30,"value":6812},"Notice the 'Pay Now' button - we'll need to use it to trigger submission of the containing form (which in turn will trigger submission/processing of the input within the braintree iframe). Notice also that we don't specify any form action - we'll be submitting our payment details by ajax, but we could instead specify an action, and send needed details via hidden fields in the form.",{"type":20,"tag":21,"props":6814,"children":6815},{},[6816],{"type":30,"value":6817},"At this point, if those additional options in the braintree.setup pointed to real functions, we would see something like:",{"type":20,"tag":21,"props":6819,"children":6820},{},[6821],{"type":20,"tag":6822,"props":6823,"children":6826},"img",{"alt":6824,"src":6825},"braintree client example","assets/images/bt_ex_1.jpg",[],{"type":20,"tag":5510,"props":6828,"children":6830},{"id":6829},"client-options",[6831],{"type":30,"value":6832},"Client Options",{"type":20,"tag":21,"props":6834,"children":6835},{},[6836,6838,6845,6847,6853],{"type":30,"value":6837},"Let's take a closer look at those ",{"type":20,"tag":25,"props":6839,"children":6842},{"href":6840,"rel":6841},"https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#setup-method-options",[50],[6843],{"type":30,"value":6844},"setup options",{"type":30,"value":6846},", then. Besides the obvious ",{"type":20,"tag":68,"props":6848,"children":6850},{"className":6849},[],[6851],{"type":30,"value":6852},"container",{"type":30,"value":6854}," option, we have three more: onReady, onPaymentMethodReceived, and onError, which we supply with callback functions. The Braintree documentation adequately explains each of them (and a number of others we aren't taking a look at today, such as an option to enable CORS requests), so let's instead take at what other things might do in the specified functions.",{"type":20,"tag":184,"props":6856,"children":6858},{"className":186,"code":6857,"language":188,"meta":8,"style":8},"    /**\n     * As this function informs us that the braintree setup is complete, if we were hiding the braintree container node\n     * or displaying some other dialog while it loaded, we could now safely reveal it to the user.\n     * @param {object} integration An object containing the teardown, paypal and deviceData objects, as noted\n     * in the braintree docs.\n     */\n    paymentMethodReady:function(integration){\n        // e.g.\n        $('#braintreeContainer').show();\n    }\n    /**\n     * Called by the braintree js SDK once the payment method has been received - that is, once the user has selected\n     * their paypal account or entered their credit card details.\n     * @param {object} recv Contains the following:\n     * nonce: The payment method nonce.\n     * type: A string representing the type of payment method generated; either 'CreditCard' or 'PayPalAccount'.\n     * details: Additional details. See https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#onpaymentmethodreceived-details-object\n     */\n    paymentMethodReceived:function(recv){\n        // We could be submitting information to our server via the form, and add information we need submitted as hidden\n        // fields on the form, but we can also submit the information we want to the server within this callback via ajax.\n        var details = {otherDetails:{/* object containing any other info we want to send up */, payment:recv};\n\n        $.ajax({\n            url:'/payment/process/',\n            type:'POST',\n            dataType:'json',\n            contentType:'application/json',\n            data:JSON.stringify(details)\n        }).done(function(res){\n            // Do something with the response from your server.\n        }.bind(this)).fail(function(jqXHR){\n            var res = jqXHR.responseJSON || jqXHR.responseText;\n            console.log(res);\n        }\n    }\n\n    /**\n     * On payment method error, this callback will receive a detail object, as noted in the setup options\n     * documentation, which gives us some idea as to what error occurred, allowing us to choose how to \n     * respond to it or inform the client about it.\n     * @param {object} detail\n     */\n    paymentMethodError:function(detail){\n        console.log(detail);\n\n        if (detail.type == \"VALIDATION\"){\n            // Potentially display a notification to your user that validation failed.\n            return;\n        }\n\n        // Potentially display or log that another type of error occurred.\n    }\n",[6859],{"type":20,"tag":68,"props":6860,"children":6861},{"__ignoreMap":8},[6862,6869,6877,6885,6911,6919,6926,6955,6963,6992,6999,7006,7014,7022,7047,7055,7063,7071,7078,7107,7115,7123,7154,7161,7176,7192,7208,7223,7240,7267,7298,7306,7353,7384,7400,7407,7414,7421,7428,7436,7444,7452,7472,7479,7504,7521,7528,7554,7562,7573,7580,7587,7595],{"type":20,"tag":194,"props":6863,"children":6864},{"class":196,"line":197},[6865],{"type":20,"tag":194,"props":6866,"children":6867},{"style":201},[6868],{"type":30,"value":1399},{"type":20,"tag":194,"props":6870,"children":6871},{"class":196,"line":207},[6872],{"type":20,"tag":194,"props":6873,"children":6874},{"style":201},[6875],{"type":30,"value":6876},"     * As this function informs us that the braintree setup is complete, if we were hiding the braintree container node\n",{"type":20,"tag":194,"props":6878,"children":6879},{"class":196,"line":216},[6880],{"type":20,"tag":194,"props":6881,"children":6882},{"style":201},[6883],{"type":30,"value":6884},"     * or displaying some other dialog while it loaded, we could now safely reveal it to the user.\n",{"type":20,"tag":194,"props":6886,"children":6887},{"class":196,"line":225},[6888,6892,6896,6901,6906],{"type":20,"tag":194,"props":6889,"children":6890},{"style":201},[6891],{"type":30,"value":1431},{"type":20,"tag":194,"props":6893,"children":6894},{"style":252},[6895],{"type":30,"value":255},{"type":20,"tag":194,"props":6897,"children":6898},{"style":258},[6899],{"type":30,"value":6900}," {object}",{"type":20,"tag":194,"props":6902,"children":6903},{"style":264},[6904],{"type":30,"value":6905}," integration",{"type":20,"tag":194,"props":6907,"children":6908},{"style":201},[6909],{"type":30,"value":6910}," An object containing the teardown, paypal and deviceData objects, as noted\n",{"type":20,"tag":194,"props":6912,"children":6913},{"class":196,"line":234},[6914],{"type":20,"tag":194,"props":6915,"children":6916},{"style":201},[6917],{"type":30,"value":6918},"     * in the braintree docs.\n",{"type":20,"tag":194,"props":6920,"children":6921},{"class":196,"line":243},[6922],{"type":20,"tag":194,"props":6923,"children":6924},{"style":201},[6925],{"type":30,"value":1448},{"type":20,"tag":194,"props":6927,"children":6928},{"class":196,"line":275},[6929,6934,6938,6942,6946,6951],{"type":20,"tag":194,"props":6930,"children":6931},{"style":258},[6932],{"type":30,"value":6933},"    paymentMethodReady",{"type":20,"tag":194,"props":6935,"children":6936},{"style":264},[6937],{"type":30,"value":1554},{"type":20,"tag":194,"props":6939,"children":6940},{"style":252},[6941],{"type":30,"value":393},{"type":20,"tag":194,"props":6943,"children":6944},{"style":264},[6945],{"type":30,"value":403},{"type":20,"tag":194,"props":6947,"children":6948},{"style":406},[6949],{"type":30,"value":6950},"integration",{"type":20,"tag":194,"props":6952,"children":6953},{"style":264},[6954],{"type":30,"value":4253},{"type":20,"tag":194,"props":6956,"children":6957},{"class":196,"line":284},[6958],{"type":20,"tag":194,"props":6959,"children":6960},{"style":201},[6961],{"type":30,"value":6962},"        // e.g.\n",{"type":20,"tag":194,"props":6964,"children":6965},{"class":196,"line":311},[6966,6971,6975,6979,6983,6988],{"type":20,"tag":194,"props":6967,"children":6968},{"style":258},[6969],{"type":30,"value":6970},"        $",{"type":20,"tag":194,"props":6972,"children":6973},{"style":264},[6974],{"type":30,"value":403},{"type":20,"tag":194,"props":6976,"children":6977},{"style":506},[6978],{"type":30,"value":6477},{"type":20,"tag":194,"props":6980,"children":6981},{"style":264},[6982],{"type":30,"value":529},{"type":20,"tag":194,"props":6984,"children":6985},{"style":258},[6986],{"type":30,"value":6987},"show",{"type":20,"tag":194,"props":6989,"children":6990},{"style":264},[6991],{"type":30,"value":539},{"type":20,"tag":194,"props":6993,"children":6994},{"class":196,"line":320},[6995],{"type":20,"tag":194,"props":6996,"children":6997},{"style":264},[6998],{"type":30,"value":1657},{"type":20,"tag":194,"props":7000,"children":7001},{"class":196,"line":347},[7002],{"type":20,"tag":194,"props":7003,"children":7004},{"style":201},[7005],{"type":30,"value":1399},{"type":20,"tag":194,"props":7007,"children":7008},{"class":196,"line":356},[7009],{"type":20,"tag":194,"props":7010,"children":7011},{"style":201},[7012],{"type":30,"value":7013},"     * Called by the braintree js SDK once the payment method has been received - that is, once the user has selected\n",{"type":20,"tag":194,"props":7015,"children":7016},{"class":196,"line":378},[7017],{"type":20,"tag":194,"props":7018,"children":7019},{"style":201},[7020],{"type":30,"value":7021},"     * their paypal account or entered their credit card details.\n",{"type":20,"tag":194,"props":7023,"children":7024},{"class":196,"line":387},[7025,7029,7033,7037,7042],{"type":20,"tag":194,"props":7026,"children":7027},{"style":201},[7028],{"type":30,"value":1431},{"type":20,"tag":194,"props":7030,"children":7031},{"style":252},[7032],{"type":30,"value":255},{"type":20,"tag":194,"props":7034,"children":7035},{"style":258},[7036],{"type":30,"value":6900},{"type":20,"tag":194,"props":7038,"children":7039},{"style":264},[7040],{"type":30,"value":7041}," recv",{"type":20,"tag":194,"props":7043,"children":7044},{"style":201},[7045],{"type":30,"value":7046}," Contains the following:\n",{"type":20,"tag":194,"props":7048,"children":7049},{"class":196,"line":445},[7050],{"type":20,"tag":194,"props":7051,"children":7052},{"style":201},[7053],{"type":30,"value":7054},"     * nonce: The payment method nonce.\n",{"type":20,"tag":194,"props":7056,"children":7057},{"class":196,"line":479},[7058],{"type":20,"tag":194,"props":7059,"children":7060},{"style":201},[7061],{"type":30,"value":7062},"     * type: A string representing the type of payment method generated; either 'CreditCard' or 'PayPalAccount'.\n",{"type":20,"tag":194,"props":7064,"children":7065},{"class":196,"line":542},[7066],{"type":20,"tag":194,"props":7067,"children":7068},{"style":201},[7069],{"type":30,"value":7070},"     * details: Additional details. See https://developers.braintreepayments.com/reference/client-reference/javascript/v2/configuration#onpaymentmethodreceived-details-object\n",{"type":20,"tag":194,"props":7072,"children":7073},{"class":196,"line":552},[7074],{"type":20,"tag":194,"props":7075,"children":7076},{"style":201},[7077],{"type":30,"value":1448},{"type":20,"tag":194,"props":7079,"children":7080},{"class":196,"line":598},[7081,7086,7090,7094,7098,7103],{"type":20,"tag":194,"props":7082,"children":7083},{"style":258},[7084],{"type":30,"value":7085},"    paymentMethodReceived",{"type":20,"tag":194,"props":7087,"children":7088},{"style":264},[7089],{"type":30,"value":1554},{"type":20,"tag":194,"props":7091,"children":7092},{"style":252},[7093],{"type":30,"value":393},{"type":20,"tag":194,"props":7095,"children":7096},{"style":264},[7097],{"type":30,"value":403},{"type":20,"tag":194,"props":7099,"children":7100},{"style":406},[7101],{"type":30,"value":7102},"recv",{"type":20,"tag":194,"props":7104,"children":7105},{"style":264},[7106],{"type":30,"value":4253},{"type":20,"tag":194,"props":7108,"children":7109},{"class":196,"line":611},[7110],{"type":20,"tag":194,"props":7111,"children":7112},{"style":201},[7113],{"type":30,"value":7114},"        // We could be submitting information to our server via the form, and add information we need submitted as hidden\n",{"type":20,"tag":194,"props":7116,"children":7117},{"class":196,"line":630},[7118],{"type":20,"tag":194,"props":7119,"children":7120},{"style":201},[7121],{"type":30,"value":7122},"        // fields on the form, but we can also submit the information we want to the server within this callback via ajax.\n",{"type":20,"tag":194,"props":7124,"children":7125},{"class":196,"line":713},[7126,7130,7135,7139,7144,7149],{"type":20,"tag":194,"props":7127,"children":7128},{"style":252},[7129],{"type":30,"value":1491},{"type":20,"tag":194,"props":7131,"children":7132},{"style":264},[7133],{"type":30,"value":7134}," details ",{"type":20,"tag":194,"props":7136,"children":7137},{"style":252},[7138],{"type":30,"value":461},{"type":20,"tag":194,"props":7140,"children":7141},{"style":264},[7142],{"type":30,"value":7143}," {otherDetails:{",{"type":20,"tag":194,"props":7145,"children":7146},{"style":201},[7147],{"type":30,"value":7148},"/* object containing any other info we want to send up */",{"type":20,"tag":194,"props":7150,"children":7151},{"style":264},[7152],{"type":30,"value":7153},", payment:recv};\n",{"type":20,"tag":194,"props":7155,"children":7156},{"class":196,"line":743},[7157],{"type":20,"tag":194,"props":7158,"children":7159},{"emptyLinePlaceholder":546},[7160],{"type":30,"value":549},{"type":20,"tag":194,"props":7162,"children":7163},{"class":196,"line":762},[7164,7168,7172],{"type":20,"tag":194,"props":7165,"children":7166},{"style":264},[7167],{"type":30,"value":6341},{"type":20,"tag":194,"props":7169,"children":7170},{"style":258},[7171],{"type":30,"value":4432},{"type":20,"tag":194,"props":7173,"children":7174},{"style":264},[7175],{"type":30,"value":4437},{"type":20,"tag":194,"props":7177,"children":7178},{"class":196,"line":771},[7179,7183,7188],{"type":20,"tag":194,"props":7180,"children":7181},{"style":264},[7182],{"type":30,"value":6390},{"type":20,"tag":194,"props":7184,"children":7185},{"style":506},[7186],{"type":30,"value":7187},"'/payment/process/'",{"type":20,"tag":194,"props":7189,"children":7190},{"style":264},[7191],{"type":30,"value":1075},{"type":20,"tag":194,"props":7193,"children":7194},{"class":196,"line":785},[7195,7199,7204],{"type":20,"tag":194,"props":7196,"children":7197},{"style":264},[7198],{"type":30,"value":6357},{"type":20,"tag":194,"props":7200,"children":7201},{"style":506},[7202],{"type":30,"value":7203},"'POST'",{"type":20,"tag":194,"props":7205,"children":7206},{"style":264},[7207],{"type":30,"value":1075},{"type":20,"tag":194,"props":7209,"children":7210},{"class":196,"line":818},[7211,7215,7219],{"type":20,"tag":194,"props":7212,"children":7213},{"style":264},[7214],{"type":30,"value":6373},{"type":20,"tag":194,"props":7216,"children":7217},{"style":506},[7218],{"type":30,"value":6378},{"type":20,"tag":194,"props":7220,"children":7221},{"style":264},[7222],{"type":30,"value":1075},{"type":20,"tag":194,"props":7224,"children":7225},{"class":196,"line":827},[7226,7231,7236],{"type":20,"tag":194,"props":7227,"children":7228},{"style":264},[7229],{"type":30,"value":7230},"            contentType:",{"type":20,"tag":194,"props":7232,"children":7233},{"style":506},[7234],{"type":30,"value":7235},"'application/json'",{"type":20,"tag":194,"props":7237,"children":7238},{"style":264},[7239],{"type":30,"value":1075},{"type":20,"tag":194,"props":7241,"children":7242},{"class":196,"line":836},[7243,7248,7253,7257,7262],{"type":20,"tag":194,"props":7244,"children":7245},{"style":264},[7246],{"type":30,"value":7247},"            data:",{"type":20,"tag":194,"props":7249,"children":7250},{"style":680},[7251],{"type":30,"value":7252},"JSON",{"type":20,"tag":194,"props":7254,"children":7255},{"style":264},[7256],{"type":30,"value":55},{"type":20,"tag":194,"props":7258,"children":7259},{"style":258},[7260],{"type":30,"value":7261},"stringify",{"type":20,"tag":194,"props":7263,"children":7264},{"style":264},[7265],{"type":30,"value":7266},"(details)\n",{"type":20,"tag":194,"props":7268,"children":7269},{"class":196,"line":844},[7270,7274,7278,7282,7286,7290,7294],{"type":20,"tag":194,"props":7271,"children":7272},{"style":264},[7273],{"type":30,"value":6403},{"type":20,"tag":194,"props":7275,"children":7276},{"style":258},[7277],{"type":30,"value":4496},{"type":20,"tag":194,"props":7279,"children":7280},{"style":264},[7281],{"type":30,"value":403},{"type":20,"tag":194,"props":7283,"children":7284},{"style":252},[7285],{"type":30,"value":393},{"type":20,"tag":194,"props":7287,"children":7288},{"style":264},[7289],{"type":30,"value":403},{"type":20,"tag":194,"props":7291,"children":7292},{"style":406},[7293],{"type":30,"value":6424},{"type":20,"tag":194,"props":7295,"children":7296},{"style":264},[7297],{"type":30,"value":4253},{"type":20,"tag":194,"props":7299,"children":7300},{"class":196,"line":858},[7301],{"type":20,"tag":194,"props":7302,"children":7303},{"style":201},[7304],{"type":30,"value":7305},"            // Do something with the response from your server.\n",{"type":20,"tag":194,"props":7307,"children":7308},{"class":196,"line":1726},[7309,7313,7317,7321,7325,7329,7333,7337,7341,7345,7349],{"type":20,"tag":194,"props":7310,"children":7311},{"style":264},[7312],{"type":30,"value":6532},{"type":20,"tag":194,"props":7314,"children":7315},{"style":258},[7316],{"type":30,"value":3818},{"type":20,"tag":194,"props":7318,"children":7319},{"style":264},[7320],{"type":30,"value":403},{"type":20,"tag":194,"props":7322,"children":7323},{"style":680},[7324],{"type":30,"value":4174},{"type":20,"tag":194,"props":7326,"children":7327},{"style":264},[7328],{"type":30,"value":6549},{"type":20,"tag":194,"props":7330,"children":7331},{"style":258},[7332],{"type":30,"value":4546},{"type":20,"tag":194,"props":7334,"children":7335},{"style":264},[7336],{"type":30,"value":403},{"type":20,"tag":194,"props":7338,"children":7339},{"style":252},[7340],{"type":30,"value":393},{"type":20,"tag":194,"props":7342,"children":7343},{"style":264},[7344],{"type":30,"value":403},{"type":20,"tag":194,"props":7346,"children":7347},{"style":406},[7348],{"type":30,"value":4563},{"type":20,"tag":194,"props":7350,"children":7351},{"style":264},[7352],{"type":30,"value":4253},{"type":20,"tag":194,"props":7354,"children":7355},{"class":196,"line":1743},[7356,7361,7366,7370,7375,7379],{"type":20,"tag":194,"props":7357,"children":7358},{"style":252},[7359],{"type":30,"value":7360},"            var",{"type":20,"tag":194,"props":7362,"children":7363},{"style":264},[7364],{"type":30,"value":7365}," res ",{"type":20,"tag":194,"props":7367,"children":7368},{"style":252},[7369],{"type":30,"value":461},{"type":20,"tag":194,"props":7371,"children":7372},{"style":264},[7373],{"type":30,"value":7374}," jqXHR.responseJSON ",{"type":20,"tag":194,"props":7376,"children":7377},{"style":252},[7378],{"type":30,"value":519},{"type":20,"tag":194,"props":7380,"children":7381},{"style":264},[7382],{"type":30,"value":7383}," jqXHR.responseText;\n",{"type":20,"tag":194,"props":7385,"children":7386},{"class":196,"line":1751},[7387,7391,7395],{"type":20,"tag":194,"props":7388,"children":7389},{"style":264},[7390],{"type":30,"value":791},{"type":20,"tag":194,"props":7392,"children":7393},{"style":258},[7394],{"type":30,"value":796},{"type":20,"tag":194,"props":7396,"children":7397},{"style":264},[7398],{"type":30,"value":7399},"(res);\n",{"type":20,"tag":194,"props":7401,"children":7402},{"class":196,"line":1776},[7403],{"type":20,"tag":194,"props":7404,"children":7405},{"style":264},[7406],{"type":30,"value":824},{"type":20,"tag":194,"props":7408,"children":7409},{"class":196,"line":1811},[7410],{"type":20,"tag":194,"props":7411,"children":7412},{"style":264},[7413],{"type":30,"value":1657},{"type":20,"tag":194,"props":7415,"children":7416},{"class":196,"line":1847},[7417],{"type":20,"tag":194,"props":7418,"children":7419},{"emptyLinePlaceholder":546},[7420],{"type":30,"value":549},{"type":20,"tag":194,"props":7422,"children":7423},{"class":196,"line":1901},[7424],{"type":20,"tag":194,"props":7425,"children":7426},{"style":201},[7427],{"type":30,"value":1399},{"type":20,"tag":194,"props":7429,"children":7430},{"class":196,"line":1937},[7431],{"type":20,"tag":194,"props":7432,"children":7433},{"style":201},[7434],{"type":30,"value":7435},"     * On payment method error, this callback will receive a detail object, as noted in the setup options\n",{"type":20,"tag":194,"props":7437,"children":7438},{"class":196,"line":1951},[7439],{"type":20,"tag":194,"props":7440,"children":7441},{"style":201},[7442],{"type":30,"value":7443},"     * documentation, which gives us some idea as to what error occurred, allowing us to choose how to \n",{"type":20,"tag":194,"props":7445,"children":7446},{"class":196,"line":1959},[7447],{"type":20,"tag":194,"props":7448,"children":7449},{"style":201},[7450],{"type":30,"value":7451},"     * respond to it or inform the client about it.\n",{"type":20,"tag":194,"props":7453,"children":7454},{"class":196,"line":1991},[7455,7459,7463,7467],{"type":20,"tag":194,"props":7456,"children":7457},{"style":201},[7458],{"type":30,"value":1431},{"type":20,"tag":194,"props":7460,"children":7461},{"style":252},[7462],{"type":30,"value":255},{"type":20,"tag":194,"props":7464,"children":7465},{"style":258},[7466],{"type":30,"value":6900},{"type":20,"tag":194,"props":7468,"children":7469},{"style":264},[7470],{"type":30,"value":7471}," detail\n",{"type":20,"tag":194,"props":7473,"children":7474},{"class":196,"line":2004},[7475],{"type":20,"tag":194,"props":7476,"children":7477},{"style":201},[7478],{"type":30,"value":1448},{"type":20,"tag":194,"props":7480,"children":7481},{"class":196,"line":2012},[7482,7487,7491,7495,7500],{"type":20,"tag":194,"props":7483,"children":7484},{"style":264},[7485],{"type":30,"value":7486},"    paymentMethodError:",{"type":20,"tag":194,"props":7488,"children":7489},{"style":252},[7490],{"type":30,"value":393},{"type":20,"tag":194,"props":7492,"children":7493},{"style":264},[7494],{"type":30,"value":403},{"type":20,"tag":194,"props":7496,"children":7497},{"style":406},[7498],{"type":30,"value":7499},"detail",{"type":20,"tag":194,"props":7501,"children":7502},{"style":264},[7503],{"type":30,"value":4253},{"type":20,"tag":194,"props":7505,"children":7506},{"class":196,"line":2020},[7507,7512,7516],{"type":20,"tag":194,"props":7508,"children":7509},{"style":264},[7510],{"type":30,"value":7511},"        console.",{"type":20,"tag":194,"props":7513,"children":7514},{"style":258},[7515],{"type":30,"value":796},{"type":20,"tag":194,"props":7517,"children":7518},{"style":264},[7519],{"type":30,"value":7520},"(detail);\n",{"type":20,"tag":194,"props":7522,"children":7523},{"class":196,"line":2028},[7524],{"type":20,"tag":194,"props":7525,"children":7526},{"emptyLinePlaceholder":546},[7527],{"type":30,"value":549},{"type":20,"tag":194,"props":7529,"children":7530},{"class":196,"line":2037},[7531,7535,7540,7545,7550],{"type":20,"tag":194,"props":7532,"children":7533},{"style":252},[7534],{"type":30,"value":1782},{"type":20,"tag":194,"props":7536,"children":7537},{"style":264},[7538],{"type":30,"value":7539}," (detail.type ",{"type":20,"tag":194,"props":7541,"children":7542},{"style":252},[7543],{"type":30,"value":7544},"==",{"type":20,"tag":194,"props":7546,"children":7547},{"style":506},[7548],{"type":30,"value":7549}," \"VALIDATION\"",{"type":20,"tag":194,"props":7551,"children":7552},{"style":264},[7553],{"type":30,"value":4253},{"type":20,"tag":194,"props":7555,"children":7556},{"class":196,"line":2045},[7557],{"type":20,"tag":194,"props":7558,"children":7559},{"style":201},[7560],{"type":30,"value":7561},"            // Potentially display a notification to your user that validation failed.\n",{"type":20,"tag":194,"props":7563,"children":7564},{"class":196,"line":2066},[7565,7569],{"type":20,"tag":194,"props":7566,"children":7567},{"style":252},[7568],{"type":30,"value":1943},{"type":20,"tag":194,"props":7570,"children":7571},{"style":264},[7572],{"type":30,"value":1384},{"type":20,"tag":194,"props":7574,"children":7575},{"class":196,"line":2087},[7576],{"type":20,"tag":194,"props":7577,"children":7578},{"style":264},[7579],{"type":30,"value":824},{"type":20,"tag":194,"props":7581,"children":7582},{"class":196,"line":2095},[7583],{"type":20,"tag":194,"props":7584,"children":7585},{"emptyLinePlaceholder":546},[7586],{"type":30,"value":549},{"type":20,"tag":194,"props":7588,"children":7589},{"class":196,"line":2128},[7590],{"type":20,"tag":194,"props":7591,"children":7592},{"style":201},[7593],{"type":30,"value":7594},"        // Potentially display or log that another type of error occurred.\n",{"type":20,"tag":194,"props":7596,"children":7597},{"class":196,"line":2147},[7598],{"type":20,"tag":194,"props":7599,"children":7600},{"style":264},[7601],{"type":30,"value":1657},{"type":20,"tag":5510,"props":7603,"children":7605},{"id":7604},"perform-transaction",[7606],{"type":30,"value":7607},"Perform Transaction",{"type":20,"tag":21,"props":7609,"children":7610},{},[7611,7613,7619],{"type":30,"value":7612},"You'll notice that we specified an endpoint of ",{"type":20,"tag":68,"props":7614,"children":7616},{"className":7615},[],[7617],{"type":30,"value":7618},"/payment/process/",{"type":30,"value":7620}," in the paymentMethodReceived callback on the client-side. So, on the server side, let's define this endpoint and finally process our payment.",{"type":20,"tag":184,"props":7622,"children":7624},{"className":5562,"code":7623,"language":5383,"meta":8,"style":8},"import braintree\nimport json\n\nfrom django.views.decorators.http import require_http_methods\nfrom django.http import JsonResponse\n\n#from yourapp.models import SaleItem, TransactionRecord\n\n@require_http_methods(['POST'])\ndef perform_braintree_simple_sale(request):\n    \"\"\"\n    Perform one-time, immediate settlement sale transaction using\n    the payment nonce sent to us by the client.\n    On failure, return the failure details to the client.\n    \"\"\"\n    try:\n        details = json.loads(request.body)\n    except ValueError:\n        # Handle the error case where you fail to parse the request body\n        return JsonResponse(status=400)\n\n    payment_details = details['payment']\n\n    # Note that we get the value of the transaction from a database row - generally speaking,\n    # it's a bad idea to trust the client to define the transaction amount - otherwise, the client\n    # may alter the request to say, have themselves charged $1 for something you want to charge $100\n    # for, and if you don't validate this, you're out $99. Allowing the client to specify what 'item' \n    # they'd like to purchase is safer, however, as long as the server remains in control of setting and\n    # confirming the price.\n    item = SaleItem.objects.get(type=\"your-sale-item\")\n    sale = {\n        \"amount\": str(item.amount),\n        \"payment_method_nonce\": payment_details['nonce'],\n        \"descriptor\": {\"name\": \"BIZ*NAME\"},\n        \"options\": {\n            \"paypal\": {\"description\": \"BizName (bizname.foo)\"},\n            # Note that setting this to true indicates we want both authorization and immediate settlement of this charge\n            \"submit_for_settlement\": True \n        }\n    }\n\n    # Perform transaction, making the remote request to braintree\n    payment_result = braintree.Transaction.sale(sale)\n\n    if payment_result.is_success is not True:\n        if not hasattr(payment_result, 'transation'):\n            \"\"\"\n            If the transaction was not successfully processed by braintree,\n            the list of possible errors is staggeringly long:\n            @see https://developers.braintreepayments.com/reference/general/validation-errors/all/python#transaction\n            You'll likely want to iterate through the deep_errors list and handle them appropriately.\n            \"\"\"\n            return JsonResponse(status=500)\n        else:\n            \"\"\"\n            If the transacation was successfully processed by braintree, but was rejected by\n            the payment processor, you'll want to handle this rejection appropriately.\n            @see https://developers.braintreepayments.com/reference/general/processor-responses/settlement-responses\n            \"\"\"\n            return JsonResponse(status=500)\n\n    transaction = payment_result.transaction\n    if transaction.amount \u003C item.amount:\n        # Confirm you actually were paid as much as your item costs! If you don't submit for settlement,\n        # or only submit for partial settlement, you should skip this check.\n        return JsonResponse(status=500)\n\n    # Transaction successful - you can now proceed to create a new user, produce a download link for an item,\n    # or whatever else it is you need payment processing for.\n    # You can also now create a local reference for the transaction, in case you ever need to look it up for refund\n    # purposes, for example.\n    TransactionRecord.objects.create(item=item, amount=transaction.amount,\n                                     transaction_id=transaction.id, type=transaction.payment_instrument_type)\n\n    return JsonResponse(status=200)\n",[7625],{"type":20,"tag":68,"props":7626,"children":7627},{"__ignoreMap":8},[7628,7639,7651,7658,7677,7696,7703,7711,7718,7737,7753,7760,7768,7776,7784,7791,7802,7819,7834,7842,7871,7878,7905,7912,7920,7928,7936,7944,7952,7960,7995,8011,8033,8055,8087,8100,8130,8138,8160,8167,8174,8181,8189,8206,8213,8244,8274,8282,8290,8298,8306,8314,8321,8348,8360,8367,8375,8383,8391,8398,8425,8432,8449,8470,8478,8486,8513,8520,8528,8536,8544,8552,8588,8618,8625],{"type":20,"tag":194,"props":7629,"children":7630},{"class":196,"line":197},[7631,7635],{"type":20,"tag":194,"props":7632,"children":7633},{"style":252},[7634],{"type":30,"value":5575},{"type":20,"tag":194,"props":7636,"children":7637},{"style":264},[7638],{"type":30,"value":5592},{"type":20,"tag":194,"props":7640,"children":7641},{"class":196,"line":207},[7642,7646],{"type":20,"tag":194,"props":7643,"children":7644},{"style":252},[7645],{"type":30,"value":5575},{"type":20,"tag":194,"props":7647,"children":7648},{"style":264},[7649],{"type":30,"value":7650}," json\n",{"type":20,"tag":194,"props":7652,"children":7653},{"class":196,"line":216},[7654],{"type":20,"tag":194,"props":7655,"children":7656},{"emptyLinePlaceholder":546},[7657],{"type":30,"value":549},{"type":20,"tag":194,"props":7659,"children":7660},{"class":196,"line":225},[7661,7665,7669,7673],{"type":20,"tag":194,"props":7662,"children":7663},{"style":252},[7664],{"type":30,"value":5749},{"type":20,"tag":194,"props":7666,"children":7667},{"style":264},[7668],{"type":30,"value":5775},{"type":20,"tag":194,"props":7670,"children":7671},{"style":252},[7672],{"type":30,"value":5575},{"type":20,"tag":194,"props":7674,"children":7675},{"style":264},[7676],{"type":30,"value":5784},{"type":20,"tag":194,"props":7678,"children":7679},{"class":196,"line":234},[7680,7684,7688,7692],{"type":20,"tag":194,"props":7681,"children":7682},{"style":252},[7683],{"type":30,"value":5749},{"type":20,"tag":194,"props":7685,"children":7686},{"style":264},[7687],{"type":30,"value":5754},{"type":20,"tag":194,"props":7689,"children":7690},{"style":252},[7691],{"type":30,"value":5575},{"type":20,"tag":194,"props":7693,"children":7694},{"style":264},[7695],{"type":30,"value":5763},{"type":20,"tag":194,"props":7697,"children":7698},{"class":196,"line":243},[7699],{"type":20,"tag":194,"props":7700,"children":7701},{"emptyLinePlaceholder":546},[7702],{"type":30,"value":549},{"type":20,"tag":194,"props":7704,"children":7705},{"class":196,"line":275},[7706],{"type":20,"tag":194,"props":7707,"children":7708},{"style":201},[7709],{"type":30,"value":7710},"#from yourapp.models import SaleItem, TransactionRecord\n",{"type":20,"tag":194,"props":7712,"children":7713},{"class":196,"line":284},[7714],{"type":20,"tag":194,"props":7715,"children":7716},{"emptyLinePlaceholder":546},[7717],{"type":30,"value":549},{"type":20,"tag":194,"props":7719,"children":7720},{"class":196,"line":311},[7721,7725,7729,7733],{"type":20,"tag":194,"props":7722,"children":7723},{"style":258},[7724],{"type":30,"value":5799},{"type":20,"tag":194,"props":7726,"children":7727},{"style":264},[7728],{"type":30,"value":5804},{"type":20,"tag":194,"props":7730,"children":7731},{"style":506},[7732],{"type":30,"value":7203},{"type":20,"tag":194,"props":7734,"children":7735},{"style":264},[7736],{"type":30,"value":5813},{"type":20,"tag":194,"props":7738,"children":7739},{"class":196,"line":320},[7740,7744,7749],{"type":20,"tag":194,"props":7741,"children":7742},{"style":252},[7743],{"type":30,"value":5821},{"type":20,"tag":194,"props":7745,"children":7746},{"style":258},[7747],{"type":30,"value":7748}," perform_braintree_simple_sale",{"type":20,"tag":194,"props":7750,"children":7751},{"style":264},[7752],{"type":30,"value":5831},{"type":20,"tag":194,"props":7754,"children":7755},{"class":196,"line":347},[7756],{"type":20,"tag":194,"props":7757,"children":7758},{"style":506},[7759],{"type":30,"value":5839},{"type":20,"tag":194,"props":7761,"children":7762},{"class":196,"line":356},[7763],{"type":20,"tag":194,"props":7764,"children":7765},{"style":506},[7766],{"type":30,"value":7767},"    Perform one-time, immediate settlement sale transaction using\n",{"type":20,"tag":194,"props":7769,"children":7770},{"class":196,"line":378},[7771],{"type":20,"tag":194,"props":7772,"children":7773},{"style":506},[7774],{"type":30,"value":7775},"    the payment nonce sent to us by the client.\n",{"type":20,"tag":194,"props":7777,"children":7778},{"class":196,"line":387},[7779],{"type":20,"tag":194,"props":7780,"children":7781},{"style":506},[7782],{"type":30,"value":7783},"    On failure, return the failure details to the client.\n",{"type":20,"tag":194,"props":7785,"children":7786},{"class":196,"line":445},[7787],{"type":20,"tag":194,"props":7788,"children":7789},{"style":506},[7790],{"type":30,"value":5839},{"type":20,"tag":194,"props":7792,"children":7793},{"class":196,"line":479},[7794,7798],{"type":20,"tag":194,"props":7795,"children":7796},{"style":252},[7797],{"type":30,"value":5862},{"type":20,"tag":194,"props":7799,"children":7800},{"style":264},[7801],{"type":30,"value":5867},{"type":20,"tag":194,"props":7803,"children":7804},{"class":196,"line":542},[7805,7810,7814],{"type":20,"tag":194,"props":7806,"children":7807},{"style":264},[7808],{"type":30,"value":7809},"        details ",{"type":20,"tag":194,"props":7811,"children":7812},{"style":252},[7813],{"type":30,"value":461},{"type":20,"tag":194,"props":7815,"children":7816},{"style":264},[7817],{"type":30,"value":7818}," json.loads(request.body)\n",{"type":20,"tag":194,"props":7820,"children":7821},{"class":196,"line":552},[7822,7826,7830],{"type":20,"tag":194,"props":7823,"children":7824},{"style":252},[7825],{"type":30,"value":5892},{"type":20,"tag":194,"props":7827,"children":7828},{"style":680},[7829],{"type":30,"value":5897},{"type":20,"tag":194,"props":7831,"children":7832},{"style":264},[7833],{"type":30,"value":5867},{"type":20,"tag":194,"props":7835,"children":7836},{"class":196,"line":598},[7837],{"type":20,"tag":194,"props":7838,"children":7839},{"style":201},[7840],{"type":30,"value":7841},"        # Handle the error case where you fail to parse the request body\n",{"type":20,"tag":194,"props":7843,"children":7844},{"class":196,"line":611},[7845,7849,7854,7858,7862,7867],{"type":20,"tag":194,"props":7846,"children":7847},{"style":252},[7848],{"type":30,"value":1591},{"type":20,"tag":194,"props":7850,"children":7851},{"style":264},[7852],{"type":30,"value":7853}," JsonResponse(",{"type":20,"tag":194,"props":7855,"children":7856},{"style":406},[7857],{"type":30,"value":5934},{"type":20,"tag":194,"props":7859,"children":7860},{"style":252},[7861],{"type":30,"value":461},{"type":20,"tag":194,"props":7863,"children":7864},{"style":680},[7865],{"type":30,"value":7866},"400",{"type":20,"tag":194,"props":7868,"children":7869},{"style":264},[7870],{"type":30,"value":5702},{"type":20,"tag":194,"props":7872,"children":7873},{"class":196,"line":630},[7874],{"type":20,"tag":194,"props":7875,"children":7876},{"emptyLinePlaceholder":546},[7877],{"type":30,"value":549},{"type":20,"tag":194,"props":7879,"children":7880},{"class":196,"line":713},[7881,7886,7890,7895,7900],{"type":20,"tag":194,"props":7882,"children":7883},{"style":264},[7884],{"type":30,"value":7885},"    payment_details ",{"type":20,"tag":194,"props":7887,"children":7888},{"style":252},[7889],{"type":30,"value":461},{"type":20,"tag":194,"props":7891,"children":7892},{"style":264},[7893],{"type":30,"value":7894}," details[",{"type":20,"tag":194,"props":7896,"children":7897},{"style":506},[7898],{"type":30,"value":7899},"'payment'",{"type":20,"tag":194,"props":7901,"children":7902},{"style":264},[7903],{"type":30,"value":7904},"]\n",{"type":20,"tag":194,"props":7906,"children":7907},{"class":196,"line":743},[7908],{"type":20,"tag":194,"props":7909,"children":7910},{"emptyLinePlaceholder":546},[7911],{"type":30,"value":549},{"type":20,"tag":194,"props":7913,"children":7914},{"class":196,"line":762},[7915],{"type":20,"tag":194,"props":7916,"children":7917},{"style":201},[7918],{"type":30,"value":7919},"    # Note that we get the value of the transaction from a database row - generally speaking,\n",{"type":20,"tag":194,"props":7921,"children":7922},{"class":196,"line":771},[7923],{"type":20,"tag":194,"props":7924,"children":7925},{"style":201},[7926],{"type":30,"value":7927},"    # it's a bad idea to trust the client to define the transaction amount - otherwise, the client\n",{"type":20,"tag":194,"props":7929,"children":7930},{"class":196,"line":785},[7931],{"type":20,"tag":194,"props":7932,"children":7933},{"style":201},[7934],{"type":30,"value":7935},"    # may alter the request to say, have themselves charged $1 for something you want to charge $100\n",{"type":20,"tag":194,"props":7937,"children":7938},{"class":196,"line":818},[7939],{"type":20,"tag":194,"props":7940,"children":7941},{"style":201},[7942],{"type":30,"value":7943},"    # for, and if you don't validate this, you're out $99. Allowing the client to specify what 'item' \n",{"type":20,"tag":194,"props":7945,"children":7946},{"class":196,"line":827},[7947],{"type":20,"tag":194,"props":7948,"children":7949},{"style":201},[7950],{"type":30,"value":7951},"    # they'd like to purchase is safer, however, as long as the server remains in control of setting and\n",{"type":20,"tag":194,"props":7953,"children":7954},{"class":196,"line":836},[7955],{"type":20,"tag":194,"props":7956,"children":7957},{"style":201},[7958],{"type":30,"value":7959},"    # confirming the price.\n",{"type":20,"tag":194,"props":7961,"children":7962},{"class":196,"line":844},[7963,7968,7972,7977,7982,7986,7991],{"type":20,"tag":194,"props":7964,"children":7965},{"style":264},[7966],{"type":30,"value":7967},"    item ",{"type":20,"tag":194,"props":7969,"children":7970},{"style":252},[7971],{"type":30,"value":461},{"type":20,"tag":194,"props":7973,"children":7974},{"style":264},[7975],{"type":30,"value":7976}," SaleItem.objects.get(",{"type":20,"tag":194,"props":7978,"children":7979},{"style":406},[7980],{"type":30,"value":7981},"type",{"type":20,"tag":194,"props":7983,"children":7984},{"style":252},[7985],{"type":30,"value":461},{"type":20,"tag":194,"props":7987,"children":7988},{"style":506},[7989],{"type":30,"value":7990},"\"your-sale-item\"",{"type":20,"tag":194,"props":7992,"children":7993},{"style":264},[7994],{"type":30,"value":5702},{"type":20,"tag":194,"props":7996,"children":7997},{"class":196,"line":858},[7998,8003,8007],{"type":20,"tag":194,"props":7999,"children":8000},{"style":264},[8001],{"type":30,"value":8002},"    sale ",{"type":20,"tag":194,"props":8004,"children":8005},{"style":252},[8006],{"type":30,"value":461},{"type":20,"tag":194,"props":8008,"children":8009},{"style":264},[8010],{"type":30,"value":595},{"type":20,"tag":194,"props":8012,"children":8013},{"class":196,"line":1726},[8014,8019,8023,8028],{"type":20,"tag":194,"props":8015,"children":8016},{"style":506},[8017],{"type":30,"value":8018},"        \"amount\"",{"type":20,"tag":194,"props":8020,"children":8021},{"style":264},[8022],{"type":30,"value":5035},{"type":20,"tag":194,"props":8024,"children":8025},{"style":680},[8026],{"type":30,"value":8027},"str",{"type":20,"tag":194,"props":8029,"children":8030},{"style":264},[8031],{"type":30,"value":8032},"(item.amount),\n",{"type":20,"tag":194,"props":8034,"children":8035},{"class":196,"line":1743},[8036,8041,8046,8051],{"type":20,"tag":194,"props":8037,"children":8038},{"style":506},[8039],{"type":30,"value":8040},"        \"payment_method_nonce\"",{"type":20,"tag":194,"props":8042,"children":8043},{"style":264},[8044],{"type":30,"value":8045},": payment_details[",{"type":20,"tag":194,"props":8047,"children":8048},{"style":506},[8049],{"type":30,"value":8050},"'nonce'",{"type":20,"tag":194,"props":8052,"children":8053},{"style":264},[8054],{"type":30,"value":6492},{"type":20,"tag":194,"props":8056,"children":8057},{"class":196,"line":1751},[8058,8063,8068,8073,8077,8082],{"type":20,"tag":194,"props":8059,"children":8060},{"style":506},[8061],{"type":30,"value":8062},"        \"descriptor\"",{"type":20,"tag":194,"props":8064,"children":8065},{"style":264},[8066],{"type":30,"value":8067},": {",{"type":20,"tag":194,"props":8069,"children":8070},{"style":506},[8071],{"type":30,"value":8072},"\"name\"",{"type":20,"tag":194,"props":8074,"children":8075},{"style":264},[8076],{"type":30,"value":5035},{"type":20,"tag":194,"props":8078,"children":8079},{"style":506},[8080],{"type":30,"value":8081},"\"BIZ*NAME\"",{"type":20,"tag":194,"props":8083,"children":8084},{"style":264},[8085],{"type":30,"value":8086},"},\n",{"type":20,"tag":194,"props":8088,"children":8089},{"class":196,"line":1776},[8090,8095],{"type":20,"tag":194,"props":8091,"children":8092},{"style":506},[8093],{"type":30,"value":8094},"        \"options\"",{"type":20,"tag":194,"props":8096,"children":8097},{"style":264},[8098],{"type":30,"value":8099},": {\n",{"type":20,"tag":194,"props":8101,"children":8102},{"class":196,"line":1811},[8103,8108,8112,8117,8121,8126],{"type":20,"tag":194,"props":8104,"children":8105},{"style":506},[8106],{"type":30,"value":8107},"            \"paypal\"",{"type":20,"tag":194,"props":8109,"children":8110},{"style":264},[8111],{"type":30,"value":8067},{"type":20,"tag":194,"props":8113,"children":8114},{"style":506},[8115],{"type":30,"value":8116},"\"description\"",{"type":20,"tag":194,"props":8118,"children":8119},{"style":264},[8120],{"type":30,"value":5035},{"type":20,"tag":194,"props":8122,"children":8123},{"style":506},[8124],{"type":30,"value":8125},"\"BizName (bizname.foo)\"",{"type":20,"tag":194,"props":8127,"children":8128},{"style":264},[8129],{"type":30,"value":8086},{"type":20,"tag":194,"props":8131,"children":8132},{"class":196,"line":1847},[8133],{"type":20,"tag":194,"props":8134,"children":8135},{"style":201},[8136],{"type":30,"value":8137},"            # Note that setting this to true indicates we want both authorization and immediate settlement of this charge\n",{"type":20,"tag":194,"props":8139,"children":8140},{"class":196,"line":1901},[8141,8146,8150,8155],{"type":20,"tag":194,"props":8142,"children":8143},{"style":506},[8144],{"type":30,"value":8145},"            \"submit_for_settlement\"",{"type":20,"tag":194,"props":8147,"children":8148},{"style":264},[8149],{"type":30,"value":5035},{"type":20,"tag":194,"props":8151,"children":8152},{"style":680},[8153],{"type":30,"value":8154},"True",{"type":20,"tag":194,"props":8156,"children":8157},{"style":264},[8158],{"type":30,"value":8159}," \n",{"type":20,"tag":194,"props":8161,"children":8162},{"class":196,"line":1937},[8163],{"type":20,"tag":194,"props":8164,"children":8165},{"style":264},[8166],{"type":30,"value":824},{"type":20,"tag":194,"props":8168,"children":8169},{"class":196,"line":1951},[8170],{"type":20,"tag":194,"props":8171,"children":8172},{"style":264},[8173],{"type":30,"value":1657},{"type":20,"tag":194,"props":8175,"children":8176},{"class":196,"line":1959},[8177],{"type":20,"tag":194,"props":8178,"children":8179},{"emptyLinePlaceholder":546},[8180],{"type":30,"value":549},{"type":20,"tag":194,"props":8182,"children":8183},{"class":196,"line":1991},[8184],{"type":20,"tag":194,"props":8185,"children":8186},{"style":201},[8187],{"type":30,"value":8188},"    # Perform transaction, making the remote request to braintree\n",{"type":20,"tag":194,"props":8190,"children":8191},{"class":196,"line":2004},[8192,8197,8201],{"type":20,"tag":194,"props":8193,"children":8194},{"style":264},[8195],{"type":30,"value":8196},"    payment_result ",{"type":20,"tag":194,"props":8198,"children":8199},{"style":252},[8200],{"type":30,"value":461},{"type":20,"tag":194,"props":8202,"children":8203},{"style":264},[8204],{"type":30,"value":8205}," braintree.Transaction.sale(sale)\n",{"type":20,"tag":194,"props":8207,"children":8208},{"class":196,"line":2012},[8209],{"type":20,"tag":194,"props":8210,"children":8211},{"emptyLinePlaceholder":546},[8212],{"type":30,"value":549},{"type":20,"tag":194,"props":8214,"children":8215},{"class":196,"line":2020},[8216,8220,8225,8230,8235,8240],{"type":20,"tag":194,"props":8217,"children":8218},{"style":252},[8219],{"type":30,"value":1360},{"type":20,"tag":194,"props":8221,"children":8222},{"style":264},[8223],{"type":30,"value":8224}," payment_result.is_success ",{"type":20,"tag":194,"props":8226,"children":8227},{"style":252},[8228],{"type":30,"value":8229},"is",{"type":20,"tag":194,"props":8231,"children":8232},{"style":252},[8233],{"type":30,"value":8234}," not",{"type":20,"tag":194,"props":8236,"children":8237},{"style":680},[8238],{"type":30,"value":8239}," True",{"type":20,"tag":194,"props":8241,"children":8242},{"style":264},[8243],{"type":30,"value":5867},{"type":20,"tag":194,"props":8245,"children":8246},{"class":196,"line":2028},[8247,8251,8255,8260,8265,8270],{"type":20,"tag":194,"props":8248,"children":8249},{"style":252},[8250],{"type":30,"value":1782},{"type":20,"tag":194,"props":8252,"children":8253},{"style":252},[8254],{"type":30,"value":8234},{"type":20,"tag":194,"props":8256,"children":8257},{"style":680},[8258],{"type":30,"value":8259}," hasattr",{"type":20,"tag":194,"props":8261,"children":8262},{"style":264},[8263],{"type":30,"value":8264},"(payment_result, ",{"type":20,"tag":194,"props":8266,"children":8267},{"style":506},[8268],{"type":30,"value":8269},"'transation'",{"type":20,"tag":194,"props":8271,"children":8272},{"style":264},[8273],{"type":30,"value":6090},{"type":20,"tag":194,"props":8275,"children":8276},{"class":196,"line":2037},[8277],{"type":20,"tag":194,"props":8278,"children":8279},{"style":506},[8280],{"type":30,"value":8281},"            \"\"\"\n",{"type":20,"tag":194,"props":8283,"children":8284},{"class":196,"line":2045},[8285],{"type":20,"tag":194,"props":8286,"children":8287},{"style":506},[8288],{"type":30,"value":8289},"            If the transaction was not successfully processed by braintree,\n",{"type":20,"tag":194,"props":8291,"children":8292},{"class":196,"line":2066},[8293],{"type":20,"tag":194,"props":8294,"children":8295},{"style":506},[8296],{"type":30,"value":8297},"            the list of possible errors is staggeringly long:\n",{"type":20,"tag":194,"props":8299,"children":8300},{"class":196,"line":2087},[8301],{"type":20,"tag":194,"props":8302,"children":8303},{"style":506},[8304],{"type":30,"value":8305},"            @see https://developers.braintreepayments.com/reference/general/validation-errors/all/python#transaction\n",{"type":20,"tag":194,"props":8307,"children":8308},{"class":196,"line":2095},[8309],{"type":20,"tag":194,"props":8310,"children":8311},{"style":506},[8312],{"type":30,"value":8313},"            You'll likely want to iterate through the deep_errors list and handle them appropriately.\n",{"type":20,"tag":194,"props":8315,"children":8316},{"class":196,"line":2128},[8317],{"type":20,"tag":194,"props":8318,"children":8319},{"style":506},[8320],{"type":30,"value":8281},{"type":20,"tag":194,"props":8322,"children":8323},{"class":196,"line":2147},[8324,8328,8332,8336,8340,8344],{"type":20,"tag":194,"props":8325,"children":8326},{"style":252},[8327],{"type":30,"value":1943},{"type":20,"tag":194,"props":8329,"children":8330},{"style":264},[8331],{"type":30,"value":7853},{"type":20,"tag":194,"props":8333,"children":8334},{"style":406},[8335],{"type":30,"value":5934},{"type":20,"tag":194,"props":8337,"children":8338},{"style":252},[8339],{"type":30,"value":461},{"type":20,"tag":194,"props":8341,"children":8342},{"style":680},[8343],{"type":30,"value":5943},{"type":20,"tag":194,"props":8345,"children":8346},{"style":264},[8347],{"type":30,"value":5702},{"type":20,"tag":194,"props":8349,"children":8350},{"class":196,"line":2175},[8351,8356],{"type":20,"tag":194,"props":8352,"children":8353},{"style":252},[8354],{"type":30,"value":8355},"        else",{"type":20,"tag":194,"props":8357,"children":8358},{"style":264},[8359],{"type":30,"value":5867},{"type":20,"tag":194,"props":8361,"children":8362},{"class":196,"line":2203},[8363],{"type":20,"tag":194,"props":8364,"children":8365},{"style":506},[8366],{"type":30,"value":8281},{"type":20,"tag":194,"props":8368,"children":8369},{"class":196,"line":2211},[8370],{"type":20,"tag":194,"props":8371,"children":8372},{"style":506},[8373],{"type":30,"value":8374},"            If the transacation was successfully processed by braintree, but was rejected by\n",{"type":20,"tag":194,"props":8376,"children":8377},{"class":196,"line":2219},[8378],{"type":20,"tag":194,"props":8379,"children":8380},{"style":506},[8381],{"type":30,"value":8382},"            the payment processor, you'll want to handle this rejection appropriately.\n",{"type":20,"tag":194,"props":8384,"children":8385},{"class":196,"line":2227},[8386],{"type":20,"tag":194,"props":8387,"children":8388},{"style":506},[8389],{"type":30,"value":8390},"            @see https://developers.braintreepayments.com/reference/general/processor-responses/settlement-responses\n",{"type":20,"tag":194,"props":8392,"children":8393},{"class":196,"line":2236},[8394],{"type":20,"tag":194,"props":8395,"children":8396},{"style":506},[8397],{"type":30,"value":8281},{"type":20,"tag":194,"props":8399,"children":8400},{"class":196,"line":2245},[8401,8405,8409,8413,8417,8421],{"type":20,"tag":194,"props":8402,"children":8403},{"style":252},[8404],{"type":30,"value":1943},{"type":20,"tag":194,"props":8406,"children":8407},{"style":264},[8408],{"type":30,"value":7853},{"type":20,"tag":194,"props":8410,"children":8411},{"style":406},[8412],{"type":30,"value":5934},{"type":20,"tag":194,"props":8414,"children":8415},{"style":252},[8416],{"type":30,"value":461},{"type":20,"tag":194,"props":8418,"children":8419},{"style":680},[8420],{"type":30,"value":5943},{"type":20,"tag":194,"props":8422,"children":8423},{"style":264},[8424],{"type":30,"value":5702},{"type":20,"tag":194,"props":8426,"children":8427},{"class":196,"line":2254},[8428],{"type":20,"tag":194,"props":8429,"children":8430},{"emptyLinePlaceholder":546},[8431],{"type":30,"value":549},{"type":20,"tag":194,"props":8433,"children":8434},{"class":196,"line":2262},[8435,8440,8444],{"type":20,"tag":194,"props":8436,"children":8437},{"style":264},[8438],{"type":30,"value":8439},"    transaction ",{"type":20,"tag":194,"props":8441,"children":8442},{"style":252},[8443],{"type":30,"value":461},{"type":20,"tag":194,"props":8445,"children":8446},{"style":264},[8447],{"type":30,"value":8448}," payment_result.transaction\n",{"type":20,"tag":194,"props":8450,"children":8451},{"class":196,"line":2286},[8452,8456,8461,8465],{"type":20,"tag":194,"props":8453,"children":8454},{"style":252},[8455],{"type":30,"value":1360},{"type":20,"tag":194,"props":8457,"children":8458},{"style":264},[8459],{"type":30,"value":8460}," transaction.amount ",{"type":20,"tag":194,"props":8462,"children":8463},{"style":252},[8464],{"type":30,"value":3674},{"type":20,"tag":194,"props":8466,"children":8467},{"style":264},[8468],{"type":30,"value":8469}," item.amount:\n",{"type":20,"tag":194,"props":8471,"children":8472},{"class":196,"line":2295},[8473],{"type":20,"tag":194,"props":8474,"children":8475},{"style":201},[8476],{"type":30,"value":8477},"        # Confirm you actually were paid as much as your item costs! If you don't submit for settlement,\n",{"type":20,"tag":194,"props":8479,"children":8480},{"class":196,"line":2319},[8481],{"type":20,"tag":194,"props":8482,"children":8483},{"style":201},[8484],{"type":30,"value":8485},"        # or only submit for partial settlement, you should skip this check.\n",{"type":20,"tag":194,"props":8487,"children":8488},{"class":196,"line":2328},[8489,8493,8497,8501,8505,8509],{"type":20,"tag":194,"props":8490,"children":8491},{"style":252},[8492],{"type":30,"value":1591},{"type":20,"tag":194,"props":8494,"children":8495},{"style":264},[8496],{"type":30,"value":7853},{"type":20,"tag":194,"props":8498,"children":8499},{"style":406},[8500],{"type":30,"value":5934},{"type":20,"tag":194,"props":8502,"children":8503},{"style":252},[8504],{"type":30,"value":461},{"type":20,"tag":194,"props":8506,"children":8507},{"style":680},[8508],{"type":30,"value":5943},{"type":20,"tag":194,"props":8510,"children":8511},{"style":264},[8512],{"type":30,"value":5702},{"type":20,"tag":194,"props":8514,"children":8515},{"class":196,"line":2352},[8516],{"type":20,"tag":194,"props":8517,"children":8518},{"emptyLinePlaceholder":546},[8519],{"type":30,"value":549},{"type":20,"tag":194,"props":8521,"children":8522},{"class":196,"line":2361},[8523],{"type":20,"tag":194,"props":8524,"children":8525},{"style":201},[8526],{"type":30,"value":8527},"    # Transaction successful - you can now proceed to create a new user, produce a download link for an item,\n",{"type":20,"tag":194,"props":8529,"children":8530},{"class":196,"line":2381},[8531],{"type":20,"tag":194,"props":8532,"children":8533},{"style":201},[8534],{"type":30,"value":8535},"    # or whatever else it is you need payment processing for.\n",{"type":20,"tag":194,"props":8537,"children":8538},{"class":196,"line":2389},[8539],{"type":20,"tag":194,"props":8540,"children":8541},{"style":201},[8542],{"type":30,"value":8543},"    # You can also now create a local reference for the transaction, in case you ever need to look it up for refund\n",{"type":20,"tag":194,"props":8545,"children":8546},{"class":196,"line":2437},[8547],{"type":20,"tag":194,"props":8548,"children":8549},{"style":201},[8550],{"type":30,"value":8551},"    # purposes, for example.\n",{"type":20,"tag":194,"props":8553,"children":8554},{"class":196,"line":2465},[8555,8560,8565,8569,8574,8579,8583],{"type":20,"tag":194,"props":8556,"children":8557},{"style":264},[8558],{"type":30,"value":8559},"    TransactionRecord.objects.create(",{"type":20,"tag":194,"props":8561,"children":8562},{"style":406},[8563],{"type":30,"value":8564},"item",{"type":20,"tag":194,"props":8566,"children":8567},{"style":252},[8568],{"type":30,"value":461},{"type":20,"tag":194,"props":8570,"children":8571},{"style":264},[8572],{"type":30,"value":8573},"item, ",{"type":20,"tag":194,"props":8575,"children":8576},{"style":406},[8577],{"type":30,"value":8578},"amount",{"type":20,"tag":194,"props":8580,"children":8581},{"style":252},[8582],{"type":30,"value":461},{"type":20,"tag":194,"props":8584,"children":8585},{"style":264},[8586],{"type":30,"value":8587},"transaction.amount,\n",{"type":20,"tag":194,"props":8589,"children":8590},{"class":196,"line":2518},[8591,8596,8600,8605,8609,8613],{"type":20,"tag":194,"props":8592,"children":8593},{"style":406},[8594],{"type":30,"value":8595},"                                     transaction_id",{"type":20,"tag":194,"props":8597,"children":8598},{"style":252},[8599],{"type":30,"value":461},{"type":20,"tag":194,"props":8601,"children":8602},{"style":264},[8603],{"type":30,"value":8604},"transaction.id, ",{"type":20,"tag":194,"props":8606,"children":8607},{"style":406},[8608],{"type":30,"value":7981},{"type":20,"tag":194,"props":8610,"children":8611},{"style":252},[8612],{"type":30,"value":461},{"type":20,"tag":194,"props":8614,"children":8615},{"style":264},[8616],{"type":30,"value":8617},"transaction.payment_instrument_type)\n",{"type":20,"tag":194,"props":8619,"children":8620},{"class":196,"line":2526},[8621],{"type":20,"tag":194,"props":8622,"children":8623},{"emptyLinePlaceholder":546},[8624],{"type":30,"value":549},{"type":20,"tag":194,"props":8626,"children":8627},{"class":196,"line":2567},[8628,8632,8636,8640,8644,8648],{"type":20,"tag":194,"props":8629,"children":8630},{"style":252},[8631],{"type":30,"value":850},{"type":20,"tag":194,"props":8633,"children":8634},{"style":264},[8635],{"type":30,"value":7853},{"type":20,"tag":194,"props":8637,"children":8638},{"style":406},[8639],{"type":30,"value":5934},{"type":20,"tag":194,"props":8641,"children":8642},{"style":252},[8643],{"type":30,"value":461},{"type":20,"tag":194,"props":8645,"children":8646},{"style":680},[8647],{"type":30,"value":1070},{"type":20,"tag":194,"props":8649,"children":8650},{"style":264},[8651],{"type":30,"value":5702},{"type":20,"tag":5510,"props":8653,"children":8655},{"id":8654},"some-assembly-required",[8656],{"type":30,"value":8657},"Some Assembly Required",{"type":20,"tag":21,"props":8659,"children":8660},{},[8661],{"type":30,"value":8662},"And there, we're done!",{"type":20,"tag":21,"props":8664,"children":8665},{},[8666,8668,8673],{"type":30,"value":8667},"... for a given value of done. Although we now have something approaching the ",{"type":20,"tag":4379,"props":8669,"children":8670},{},[8671],{"type":30,"value":8672},"bare minimum",{"type":30,"value":8674}," for processing a transaction, what we have doesn't account for recurring subscriptions, storing customer information in the braintree 'vault', sub-merchants, handling refunds, performing authorizations and settling at a future time...",{"type":20,"tag":21,"props":8676,"children":8677},{},[8678,8680,8685],{"type":30,"value":8679},"For more information, I direct you once again to braintree's well-written ",{"type":20,"tag":25,"props":8681,"children":8683},{"href":5426,"rel":8682},[50],[8684],{"type":30,"value":5430},{"type":30,"value":8686},", and I would suggest directing any questions you may have to StackOverflow, where I've noted braintree developers to be fairly quick to respond with assistance.",{"type":20,"tag":21,"props":8688,"children":8689},{},[8690],{"type":30,"value":8691},"At this point, however, you should have the beginnings of a working implementation. Soon, your users will be happily trading in their useless monetary units for the happiness and lasting contentment that only cat pictures can provide. Cheers!",{"type":20,"tag":21,"props":8693,"children":8694},{},[8695],{"type":20,"tag":4379,"props":8696,"children":8697},{},[8698,8700],{"type":30,"value":8699},"Cat image: CC-BY licensed, via ",{"type":20,"tag":25,"props":8701,"children":8704},{"href":8702,"rel":8703},"https://www.flickr.com/photos/53911972@N03/",[50],[8705],{"type":30,"value":8702},{"type":20,"tag":3951,"props":8707,"children":8708},{},[8709],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":8711},[8712,8713,8714,8715,8716],{"id":5512,"depth":207,"text":5515},{"id":6225,"depth":207,"text":6228},{"id":6829,"depth":207,"text":6832},{"id":7604,"depth":207,"text":7607},{"id":8654,"depth":207,"text":8657},"content:ckeefer:2016-2:paymentprocessing.md","ckeefer/2016-2/paymentprocessing.md","ckeefer/2016-2/paymentprocessing",{"user":3970,"name":3971},{"_path":8722,"_dir":8723,"_draft":7,"_partial":7,"_locale":8,"title":8724,"description":8725,"publishDate":8726,"tags":8727,"excerpt":8725,"body":8728,"_type":3963,"_id":14799,"_source":3965,"_file":14800,"_stem":14801,"_extension":3968,"author":14802},"/ckeefer/2016-1/ajaxbinarycaching","2016-1","Caching Binary Data With jQuery Ajax and IndexedDB","After long, grueling months (years? or does it only feel like years?), your web application nears completion. It is tightly coded, well documented, works across all modern browsers, and is well received by your beta testers. It's nearly time to go live, and a smile of pure relief plays upon your lips... and freezes into a rictus grin when your client turns to you, and asks, \"so, hey, can we speed up the dynamic cat pic loading? Especially when I close the browser and come back to it later. I think that's really key to the whole application.\"","2016-04-25",[13,14],{"type":17,"children":8729,"toc":14792},[8730,8734,8769,8774,8786,8792,8798,8839,8853,8864,8869,8907,8914,8954,8982,8988,9000,9029,9042,11902,11912,11917,11931,14738,14751,14757,14776,14788],{"type":20,"tag":21,"props":8731,"children":8732},{},[8733],{"type":30,"value":8725},{"type":20,"tag":21,"props":8735,"children":8736},{},[8737,8743,8745,8751,8753,8760,8762,8768],{"type":20,"tag":25,"props":8738,"children":8740},{"href":8739},"/search/ajax/upload/user:ckeefer",[8741],{"type":30,"value":8742},"Long, long ago",{"type":30,"value":8744}," we discussed our ",{"type":20,"tag":25,"props":8746,"children":8748},{"href":135,"rel":8747},[50],[8749],{"type":30,"value":8750},"jQuery plugin",{"type":30,"value":8752}," that will allow you to cache responses of ajax queries in ",{"type":20,"tag":25,"props":8754,"children":8757},{"href":8755,"rel":8756},"https://developer.mozilla.org/en/docs/Web/API/Window/localStorage",[50],[8758],{"type":30,"value":8759},"Local Storage",{"type":30,"value":8761},", so long as they're strings, or something that can be coerced to a string (objects as JSON, numbers). We also previously discussed adding an ajax transport to allow us to handle ",{"type":20,"tag":25,"props":8763,"children":8765},{"href":8764},"/search/user:ckeefer/ajax/blobs",[8766],{"type":30,"value":8767},"sending and receiving binary blobs and array buffers via jQuery ajax",{"type":30,"value":55},{"type":20,"tag":21,"props":8770,"children":8771},{},[8772],{"type":30,"value":8773},"But what if we need to cache binary blobs or arraybuffers? Say, we need those cat pics on the double - we could convert them to and from base64, but not only is that slow, but we're certain to run up against the 5MB limit of local storage in short order. No, what we need is some way to cache binary data in some sort of client-side database...",{"type":20,"tag":21,"props":8775,"children":8776},{},[8777,8784],{"type":20,"tag":25,"props":8778,"children":8781},{"href":8779,"rel":8780},"https://github.com/SaneMethod/jalic",[50],[8782],{"type":30,"value":8783},"Want to get straight to the goods? Here's the link to the Github repo",{"type":30,"value":8785}," - keep reading for the details.",{"type":20,"tag":35,"props":8787,"children":8789},{"id":8788},"picking-the-appropriate-tool-for-the-job",[8790],{"type":30,"value":8791},"Picking the appropriate tool for the job",{"type":20,"tag":4037,"props":8793,"children":8795},{"id":8794},"or-any-tool-really",[8796],{"type":30,"value":8797},"Or any tool, really",{"type":20,"tag":21,"props":8799,"children":8800},{},[8801,8803,8810,8812,8819,8821,8828,8830,8837],{"type":30,"value":8802},"There are a number of candidates that could (or once could have) provided our solution. If we knew exactly what resources would be needed on first visit (and, as an added bonus, wanted at least some part of the web application available offline), we could have used ",{"type":20,"tag":25,"props":8804,"children":8807},{"href":8805,"rel":8806},"https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache",[50],[8808],{"type":30,"value":8809},"Application Cache",{"type":30,"value":8811},". I say could have, because ",{"type":20,"tag":25,"props":8813,"children":8816},{"href":8814,"rel":8815},"http://caniuse.com/#feat=offline-apps",[50],[8817],{"type":30,"value":8818},"Application Cache is dead",{"type":30,"value":8820}," (long live ",{"type":20,"tag":25,"props":8822,"children":8825},{"href":8823,"rel":8824},"https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers",[50],[8826],{"type":30,"value":8827},"Service Workers",{"type":30,"value":8829},"). Its replacement, Service Workers, ",{"type":20,"tag":25,"props":8831,"children":8834},{"href":8832,"rel":8833},"http://caniuse.com/#feat=serviceworkers",[50],[8835],{"type":30,"value":8836},"isn't widely supported yet",{"type":30,"value":8838},", and this doesn't really fit our use case that well anyways.",{"type":20,"tag":21,"props":8840,"children":8841},{},[8842,8844,8851],{"type":30,"value":8843},"Well, what we really need is on-demand file storage. Hey, I remember reading about a ",{"type":20,"tag":25,"props":8845,"children":8848},{"href":8846,"rel":8847},"https://developer.mozilla.org/en-US/docs/Web/API/File_System_API",[50],[8849],{"type":30,"value":8850},"File System API",{"type":30,"value":8852}," once, whatever happened to that?",{"type":20,"tag":21,"props":8854,"children":8855},{},[8856,8863],{"type":20,"tag":25,"props":8857,"children":8860},{"href":8858,"rel":8859},"http://caniuse.com/#feat=filesystem",[50],[8861],{"type":30,"value":8862},"Also dead",{"type":30,"value":55},{"type":20,"tag":21,"props":8865,"children":8866},{},[8867],{"type":30,"value":8868},"Our options are looking a little thinner on the ground, now. But wait! If you're also familiar with the server-side of web development, you're probably thinking (a little guiltily) of the last time you couldn't use the file system but needed to store files. If we can't use the file system - how about the database?",{"type":20,"tag":21,"props":8870,"children":8871},{},[8872,8879,8881,8888,8890,8897,8899,8906],{"type":20,"tag":25,"props":8873,"children":8876},{"href":8874,"rel":8875},"https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API",[50],[8877],{"type":30,"value":8878},"IndexedDB",{"type":30,"value":8880}," to the rescue! (Not WebSQL, that's ",{"type":20,"tag":25,"props":8882,"children":8885},{"href":8883,"rel":8884},"http://caniuse.com/#feat=sql-storage",[50],[8886],{"type":30,"value":8887},"also dead",{"type":30,"value":8889},".) IndexedDB is fairly ",{"type":20,"tag":25,"props":8891,"children":8894},{"href":8892,"rel":8893},"http://caniuse.com/#feat=indexeddb",[50],[8895],{"type":30,"value":8896},"widely-supported by modern browsers",{"type":30,"value":8898},", and we can definitely ",{"type":20,"tag":25,"props":8900,"children":8903},{"href":8901,"rel":8902},"https://msdn.microsoft.com/en-us/library/hh779017%28v=vs.85%29.aspx",[50],[8904],{"type":30,"value":8905},"store binary data in an IndexedDB database",{"type":30,"value":55},{"type":20,"tag":8908,"props":8909,"children":8911},"h4",{"id":8910},"if-you-pretend-complexity-and-async-operations-arent-there-they-go-away-on-their-own",[8912],{"type":30,"value":8913},"If you pretend complexity and async operations aren't there, they go away on their own",{"type":20,"tag":21,"props":8915,"children":8916},{},[8917,8919,8926,8928,8935,8937,8944,8945,8952],{"type":30,"value":8918},"One issue is that IndexedDB has a reputation for being ",{"type":20,"tag":25,"props":8920,"children":8923},{"href":8921,"rel":8922},"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB",[50],[8924],{"type":30,"value":8925},"fairly complex",{"type":30,"value":8927},". No worries, some helpful ",{"type":20,"tag":25,"props":8929,"children":8932},{"href":8930,"rel":8931},"https://github.com/SaneMethod",[50],[8933],{"type":30,"value":8934},"open source author",{"type":30,"value":8936}," will help abstract that away for you (see also the excellent ",{"type":20,"tag":25,"props":8938,"children":8941},{"href":8939,"rel":8940},"https://github.com/mozilla/localForage",[50],[8942],{"type":30,"value":8943},"localForage",{"type":30,"value":174},{"type":20,"tag":25,"props":8946,"children":8949},{"href":8947,"rel":8948},"http://dexie.org/",[50],[8950],{"type":30,"value":8951},"Dexie",{"type":30,"value":8953}," projects if you intend to use IndexedDB for any purpose other than caching ajax requests in your application).",{"type":20,"tag":21,"props":8955,"children":8956},{},[8957,8959,8965,8967,8973,8975,8980],{"type":30,"value":8958},"The other concern for the purpose of our ajax caching is that IndexedDB operates asynchronously (like an XHR - no, I don't want to hear about sync XHR, that's ",{"type":20,"tag":25,"props":8960,"children":8963},{"href":8961,"rel":8962},"https://developers.google.com/web/updates/2012/01/Getting-Rid-of-Synchronous-XHRs?hl=en",[50],[8964],{"type":30,"value":8887},{"type":30,"value":8966},", and good riddance). Our ",{"type":20,"tag":25,"props":8968,"children":8970},{"href":135,"rel":8969},[50],[8971],{"type":30,"value":8972},"Jalc plugin",{"type":30,"value":8974}," that allows us to cache jquery ajax responses, relies on the ability to specify an ajax transport for a given request - and it needs to respond with a value ",{"type":20,"tag":4379,"props":8976,"children":8977},{},[8978],{"type":30,"value":8979},"synchronously",{"type":30,"value":8981}," if it's going to handle the request instead of simply passing it on to the next transport factory.",{"type":20,"tag":35,"props":8983,"children":8985},{"id":8984},"two-for-the-price-of-one",[8986],{"type":30,"value":8987},"Two for the price of one",{"type":20,"tag":21,"props":8989,"children":8990},{},[8991,8993,8998],{"type":30,"value":8992},"So, what we need to do is store and retrieve a cached value asychronously, but know whether the value ",{"type":20,"tag":4379,"props":8994,"children":8995},{},[8996],{"type":30,"value":8997},"exists",{"type":30,"value":8999}," sychronously. Thus, the solution - use both LocalStorage and IndexedDB. So, we extend our JALC plugin - first, we add the ability to send and receive binary data in the form of blobs and array buffers, and then we set up an indexeddb database for storing our values.",{"type":20,"tag":21,"props":9001,"children":9002},{},[9003,9005,9012,9014,9020,9022,9027],{"type":30,"value":9004},"I'll skip over the code for the binary sending and receiving, since we've mostly seen it before (you can ",{"type":20,"tag":25,"props":9006,"children":9009},{"href":9007,"rel":9008},"https://github.com/SaneMethod/jalic/blob/master/jquery-ajax-binary-patch.js",[50],[9010],{"type":30,"value":9011},"view it in the Github repo",{"type":30,"value":9013},", however). You'll require such a patch, as adding support for binary requests in jQuery is ",{"type":20,"tag":25,"props":9015,"children":9018},{"href":9016,"rel":9017},"https://github.com/jquery/jquery/pull/1525",[50],[9019],{"type":30,"value":8887},{"type":30,"value":9021},", and $.xhr and the ",{"type":20,"tag":25,"props":9023,"children":9025},{"href":4014,"rel":9024},[50],[9026],{"type":30,"value":5338},{"type":30,"value":9028}," isn't ready for prime-time yet.",{"type":20,"tag":21,"props":9030,"children":9031},{},[9032,9034,9041],{"type":30,"value":9033},"Let's take a quick walk through what we're doing to support IndexedDB, however (",{"type":20,"tag":25,"props":9035,"children":9038},{"href":9036,"rel":9037},"https://github.com/SaneMethod/jalic/blob/master/indexeddb-setup.js",[50],[9039],{"type":30,"value":9040},"see the up-to-date version on Github",{"type":30,"value":529},{"type":20,"tag":184,"props":9043,"children":9045},{"className":186,"code":9044,"language":188,"meta":8,"style":8},"(function($, window){\n    var idb = window.indexedDB,\n        dbReady = $.Deferred(),\n        db;\n\n    /**\n     * At this point, we'll only support unprefixed, non-experimental versions of IndexedDB, to simplify our\n     * lives - there are a number of differences we would need to account for if we were to attempt to support\n     * early attempts at IndexedDB implementations, some of which you can read about in the excellent MDN\n     * documentation at\n     * https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API and\n     * https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB.\n     */\n    if (!window.indexedDB) throw new Error(\"Expecting unprefixed IndexedDB support on window object.\");\n\n    /**\n     * Create the 'jalic' IndexedDB db.\n     * For now, we handle errors merely by logging them and rejecting the associated Deferred object with the\n     * error event. This should be replaced by something more robust in the future...\n     *\n     * @param idb\n     * @returns {*}\n     */\n    function createDatabase(idb){\n        var dbreq = idb.open(\"jalic\", 1);\n\n        /**\n         * Something went wrong when opening our db. This could range from the user refusing the\n         * request to allow this site to store data, to the current version of the db being higher\n         * than the one we requested, to storage issues or lacking implementation.\n         * @param event\n         */\n        dbreq.onerror = function(event){\n            console.log(event);\n            dbReady.reject(event);\n        };\n\n        /**\n         * The on upgrade needed event is called whenever we're opening a database with a version number\n         * higher than the currently existing version number, which includes when the database doesn't\n         * currently exist. Within this function we define the structure of the db.\n         * @param event\n         */\n        dbreq.onupgradeneeded = function(event){\n            var objectStore;\n\n            db = event.target.result;\n            db.onerror = function(event){\n                console.log(event);\n            };\n\n            objectStore = db.createObjectStore(\"jalicData\", {keyPath:\"jdName\"});\n            objectStore.createIndex(\"storedAt\", \"storedAt\", {unique:false});\n\n            objectStore.transaction.oncomplete = function(event){\n                dbReady.resolve();\n            };\n        };\n\n        /**\n         * DB was opened successfully, with no upgrade needed.\n         * @param event\n         */\n        dbreq.onsuccess = function(event){\n            db = event.target.result;\n            dbReady.resolve();\n        };\n\n        return dbReady.promise();\n    }\n\n    createDatabase(idb);\n\n    /**\n     * Define a simple interface mimicking the Storage interface on the jQuery object, with the major difference being\n     * everything executes asynchronously, and returns a $.Deferred object to account for that.\n     */\n    $.jidb = {\n        /**\n         * Set an item within the jalicData objectStore, using the given jdName and data, with optionally\n         * a dataType parameter to store alongside the data. If dataType is not provided, it is the result of\n         * typeof data.\n         * Notice that we 'put' data, rather than add it - that means we will always overwrite data with an\n         * identical key (jdName), if it already exists.\n         * @param jdName\n         * @param data\n         * @param dataType\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with an empty body on success,\n         * or else resolves with the transaction or request error on failure.\n         */\n        setItem:function(jdName, data, dataType){\n            var defer = $.Deferred(),\n                transaction = db.transaction([\"jalicData\"], \"readwrite\"),\n                objectStore = transaction.objectStore(\"jalicData\"),\n                request;\n\n            dataType = dataType || typeof data;\n\n            transaction.oncomplete = function(){\n                return defer.resolve();\n            };\n\n            transaction.onerror = function(event){\n                console.log(event);\n                return defer.reject(event);\n            };\n\n            request = objectStore.put({jdName:jdName, storedAt:+new Date(), dataType:dataType, data:data});\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            return defer.promise();\n        },\n        /**\n         * Retrieve an item from the jalicData objectStore, using the given jdName as the key.\n         * @param jdName\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with the request result as an object\n         * on success, or else resolves with the transaction or request error on failure.\n         */\n        getItem:function(jdName){\n            var defer = $.Deferred(),\n                transaction = db.transaction([\"jalicData\"], \"readonly\"),\n                objectStore = transaction.objectStore(\"jalicData\"),\n                request = objectStore.get(jdName);\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            request.onsuccess = function(event){\n                defer.resolve(request.result);\n            };\n\n            return defer.promise();\n        },\n        /**\n         * Remove an item from the jalicData objectStore, using the given jdName as the key.\n         * @param jdName\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with an empty body on success,\n         * or else resolves with the transaction or request error on failure.\n         */\n        removeItem:function(jdName){\n            var defer = $.Deferred(),\n                transaction = db.transaction([\"jalicData\"], \"readwrite\"),\n                objectStore = transaction.objectStore(\"jalicData\"),\n                request = objectStore.delete(jdName);\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            request.onsuccess = function(){\n                defer.resolve();\n            };\n\n            return defer.promise();\n        },\n        /**\n         * Delete the jalic database and recreate it.\n         * @returns {$.Deferred} Returns a jQuery Deferred object, which resolves with an empty body on success,\n         * or else resolves with the transaction or request error on failure.\n         */\n        clear:function(){\n            var defer = $.Deferred(),\n                request = idb.deleteDatabase(\"jalic\");\n\n            dbReady = $.Deferred();\n\n            request.onerror = function(event){\n                console.log(event);\n                defer.reject(event);\n            };\n\n            request.onsuccess = function(){\n                dbReady.done(function(){\n                    defer.resolve();\n                });\n\n                createDatabase(idb);\n            };\n\n            return defer.promise();\n        }\n    };\n})(jQuery, window);\n",[9046],{"type":20,"tag":68,"props":9047,"children":9048},{"__ignoreMap":8},[9049,9081,9102,9128,9136,9143,9150,9158,9166,9174,9182,9190,9198,9205,9250,9257,9264,9272,9280,9288,9295,9311,9327,9334,9359,9406,9413,9420,9428,9436,9444,9461,9468,9502,9518,9534,9542,9549,9556,9564,9572,9580,9595,9602,9634,9646,9653,9670,9702,9717,9725,9732,9777,9821,9828,9861,9877,9884,9891,9898,9905,9913,9928,9935,9967,9982,9997,10004,10011,10032,10039,10046,10059,10066,10073,10081,10089,10096,10112,10119,10127,10135,10143,10151,10159,10175,10191,10206,10227,10235,10242,10287,10315,10358,10392,10400,10407,10436,10443,10467,10488,10495,10502,10533,10548,10567,10574,10581,10621,10628,10660,10675,10691,10698,10705,10724,10732,10739,10747,10762,10782,10790,10797,10825,10852,10892,10923,10948,10955,10986,11001,11016,11023,11030,11061,11077,11084,11091,11110,11117,11124,11132,11147,11166,11173,11180,11208,11235,11274,11305,11329,11336,11367,11382,11397,11404,11411,11434,11449,11456,11463,11482,11490,11498,11507,11527,11535,11543,11564,11592,11625,11633,11658,11666,11698,11714,11730,11738,11746,11770,11794,11811,11820,11828,11841,11849,11857,11877,11885,11893],{"type":20,"tag":194,"props":9050,"children":9051},{"class":196,"line":197},[9052,9056,9060,9064,9068,9072,9077],{"type":20,"tag":194,"props":9053,"children":9054},{"style":264},[9055],{"type":30,"value":403},{"type":20,"tag":194,"props":9057,"children":9058},{"style":252},[9059],{"type":30,"value":393},{"type":20,"tag":194,"props":9061,"children":9062},{"style":264},[9063],{"type":30,"value":403},{"type":20,"tag":194,"props":9065,"children":9066},{"style":406},[9067],{"type":30,"value":6468},{"type":20,"tag":194,"props":9069,"children":9070},{"style":264},[9071],{"type":30,"value":414},{"type":20,"tag":194,"props":9073,"children":9074},{"style":406},[9075],{"type":30,"value":9076},"window",{"type":20,"tag":194,"props":9078,"children":9079},{"style":264},[9080],{"type":30,"value":4253},{"type":20,"tag":194,"props":9082,"children":9083},{"class":196,"line":207},[9084,9088,9093,9097],{"type":20,"tag":194,"props":9085,"children":9086},{"style":252},[9087],{"type":30,"value":451},{"type":20,"tag":194,"props":9089,"children":9090},{"style":264},[9091],{"type":30,"value":9092}," idb ",{"type":20,"tag":194,"props":9094,"children":9095},{"style":252},[9096],{"type":30,"value":461},{"type":20,"tag":194,"props":9098,"children":9099},{"style":264},[9100],{"type":30,"value":9101}," window.indexedDB,\n",{"type":20,"tag":194,"props":9103,"children":9104},{"class":196,"line":216},[9105,9110,9114,9119,9124],{"type":20,"tag":194,"props":9106,"children":9107},{"style":264},[9108],{"type":30,"value":9109},"        dbReady ",{"type":20,"tag":194,"props":9111,"children":9112},{"style":252},[9113],{"type":30,"value":461},{"type":20,"tag":194,"props":9115,"children":9116},{"style":264},[9117],{"type":30,"value":9118}," $.",{"type":20,"tag":194,"props":9120,"children":9121},{"style":258},[9122],{"type":30,"value":9123},"Deferred",{"type":20,"tag":194,"props":9125,"children":9126},{"style":264},[9127],{"type":30,"value":476},{"type":20,"tag":194,"props":9129,"children":9130},{"class":196,"line":225},[9131],{"type":20,"tag":194,"props":9132,"children":9133},{"style":264},[9134],{"type":30,"value":9135},"        db;\n",{"type":20,"tag":194,"props":9137,"children":9138},{"class":196,"line":234},[9139],{"type":20,"tag":194,"props":9140,"children":9141},{"emptyLinePlaceholder":546},[9142],{"type":30,"value":549},{"type":20,"tag":194,"props":9144,"children":9145},{"class":196,"line":243},[9146],{"type":20,"tag":194,"props":9147,"children":9148},{"style":201},[9149],{"type":30,"value":1399},{"type":20,"tag":194,"props":9151,"children":9152},{"class":196,"line":275},[9153],{"type":20,"tag":194,"props":9154,"children":9155},{"style":201},[9156],{"type":30,"value":9157},"     * At this point, we'll only support unprefixed, non-experimental versions of IndexedDB, to simplify our\n",{"type":20,"tag":194,"props":9159,"children":9160},{"class":196,"line":284},[9161],{"type":20,"tag":194,"props":9162,"children":9163},{"style":201},[9164],{"type":30,"value":9165},"     * lives - there are a number of differences we would need to account for if we were to attempt to support\n",{"type":20,"tag":194,"props":9167,"children":9168},{"class":196,"line":311},[9169],{"type":20,"tag":194,"props":9170,"children":9171},{"style":201},[9172],{"type":30,"value":9173},"     * early attempts at IndexedDB implementations, some of which you can read about in the excellent MDN\n",{"type":20,"tag":194,"props":9175,"children":9176},{"class":196,"line":320},[9177],{"type":20,"tag":194,"props":9178,"children":9179},{"style":201},[9180],{"type":30,"value":9181},"     * documentation at\n",{"type":20,"tag":194,"props":9183,"children":9184},{"class":196,"line":347},[9185],{"type":20,"tag":194,"props":9186,"children":9187},{"style":201},[9188],{"type":30,"value":9189},"     * https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API and\n",{"type":20,"tag":194,"props":9191,"children":9192},{"class":196,"line":356},[9193],{"type":20,"tag":194,"props":9194,"children":9195},{"style":201},[9196],{"type":30,"value":9197},"     * https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB.\n",{"type":20,"tag":194,"props":9199,"children":9200},{"class":196,"line":378},[9201],{"type":20,"tag":194,"props":9202,"children":9203},{"style":201},[9204],{"type":30,"value":1448},{"type":20,"tag":194,"props":9206,"children":9207},{"class":196,"line":387},[9208,9212,9216,9220,9225,9229,9233,9237,9241,9246],{"type":20,"tag":194,"props":9209,"children":9210},{"style":252},[9211],{"type":30,"value":1360},{"type":20,"tag":194,"props":9213,"children":9214},{"style":264},[9215],{"type":30,"value":1172},{"type":20,"tag":194,"props":9217,"children":9218},{"style":252},[9219],{"type":30,"value":1369},{"type":20,"tag":194,"props":9221,"children":9222},{"style":264},[9223],{"type":30,"value":9224},"window.indexedDB) ",{"type":20,"tag":194,"props":9226,"children":9227},{"style":252},[9228],{"type":30,"value":5204},{"type":20,"tag":194,"props":9230,"children":9231},{"style":252},[9232],{"type":30,"value":1031},{"type":20,"tag":194,"props":9234,"children":9235},{"style":258},[9236],{"type":30,"value":5213},{"type":20,"tag":194,"props":9238,"children":9239},{"style":264},[9240],{"type":30,"value":403},{"type":20,"tag":194,"props":9242,"children":9243},{"style":506},[9244],{"type":30,"value":9245},"\"Expecting unprefixed IndexedDB support on window object.\"",{"type":20,"tag":194,"props":9247,"children":9248},{"style":264},[9249],{"type":30,"value":1649},{"type":20,"tag":194,"props":9251,"children":9252},{"class":196,"line":445},[9253],{"type":20,"tag":194,"props":9254,"children":9255},{"emptyLinePlaceholder":546},[9256],{"type":30,"value":549},{"type":20,"tag":194,"props":9258,"children":9259},{"class":196,"line":479},[9260],{"type":20,"tag":194,"props":9261,"children":9262},{"style":201},[9263],{"type":30,"value":1399},{"type":20,"tag":194,"props":9265,"children":9266},{"class":196,"line":542},[9267],{"type":20,"tag":194,"props":9268,"children":9269},{"style":201},[9270],{"type":30,"value":9271},"     * Create the 'jalic' IndexedDB db.\n",{"type":20,"tag":194,"props":9273,"children":9274},{"class":196,"line":552},[9275],{"type":20,"tag":194,"props":9276,"children":9277},{"style":201},[9278],{"type":30,"value":9279},"     * For now, we handle errors merely by logging them and rejecting the associated Deferred object with the\n",{"type":20,"tag":194,"props":9281,"children":9282},{"class":196,"line":598},[9283],{"type":20,"tag":194,"props":9284,"children":9285},{"style":201},[9286],{"type":30,"value":9287},"     * error event. This should be replaced by something more robust in the future...\n",{"type":20,"tag":194,"props":9289,"children":9290},{"class":196,"line":611},[9291],{"type":20,"tag":194,"props":9292,"children":9293},{"style":201},[9294],{"type":30,"value":1423},{"type":20,"tag":194,"props":9296,"children":9297},{"class":196,"line":630},[9298,9302,9306],{"type":20,"tag":194,"props":9299,"children":9300},{"style":201},[9301],{"type":30,"value":1431},{"type":20,"tag":194,"props":9303,"children":9304},{"style":252},[9305],{"type":30,"value":255},{"type":20,"tag":194,"props":9307,"children":9308},{"style":264},[9309],{"type":30,"value":9310}," idb\n",{"type":20,"tag":194,"props":9312,"children":9313},{"class":196,"line":713},[9314,9318,9322],{"type":20,"tag":194,"props":9315,"children":9316},{"style":201},[9317],{"type":30,"value":1431},{"type":20,"tag":194,"props":9319,"children":9320},{"style":252},[9321],{"type":30,"value":964},{"type":20,"tag":194,"props":9323,"children":9324},{"style":258},[9325],{"type":30,"value":9326}," {*}\n",{"type":20,"tag":194,"props":9328,"children":9329},{"class":196,"line":743},[9330],{"type":20,"tag":194,"props":9331,"children":9332},{"style":201},[9333],{"type":30,"value":1448},{"type":20,"tag":194,"props":9335,"children":9336},{"class":196,"line":762},[9337,9341,9346,9350,9355],{"type":20,"tag":194,"props":9338,"children":9339},{"style":252},[9340],{"type":30,"value":1456},{"type":20,"tag":194,"props":9342,"children":9343},{"style":258},[9344],{"type":30,"value":9345}," createDatabase",{"type":20,"tag":194,"props":9347,"children":9348},{"style":264},[9349],{"type":30,"value":403},{"type":20,"tag":194,"props":9351,"children":9352},{"style":406},[9353],{"type":30,"value":9354},"idb",{"type":20,"tag":194,"props":9356,"children":9357},{"style":264},[9358],{"type":30,"value":4253},{"type":20,"tag":194,"props":9360,"children":9361},{"class":196,"line":771},[9362,9366,9371,9375,9380,9384,9388,9393,9397,9402],{"type":20,"tag":194,"props":9363,"children":9364},{"style":252},[9365],{"type":30,"value":1491},{"type":20,"tag":194,"props":9367,"children":9368},{"style":264},[9369],{"type":30,"value":9370}," dbreq ",{"type":20,"tag":194,"props":9372,"children":9373},{"style":252},[9374],{"type":30,"value":461},{"type":20,"tag":194,"props":9376,"children":9377},{"style":264},[9378],{"type":30,"value":9379}," idb.",{"type":20,"tag":194,"props":9381,"children":9382},{"style":258},[9383],{"type":30,"value":4325},{"type":20,"tag":194,"props":9385,"children":9386},{"style":264},[9387],{"type":30,"value":403},{"type":20,"tag":194,"props":9389,"children":9390},{"style":506},[9391],{"type":30,"value":9392},"\"jalic\"",{"type":20,"tag":194,"props":9394,"children":9395},{"style":264},[9396],{"type":30,"value":414},{"type":20,"tag":194,"props":9398,"children":9399},{"style":680},[9400],{"type":30,"value":9401},"1",{"type":20,"tag":194,"props":9403,"children":9404},{"style":264},[9405],{"type":30,"value":1649},{"type":20,"tag":194,"props":9407,"children":9408},{"class":196,"line":785},[9409],{"type":20,"tag":194,"props":9410,"children":9411},{"emptyLinePlaceholder":546},[9412],{"type":30,"value":549},{"type":20,"tag":194,"props":9414,"children":9415},{"class":196,"line":818},[9416],{"type":20,"tag":194,"props":9417,"children":9418},{"style":201},[9419],{"type":30,"value":6297},{"type":20,"tag":194,"props":9421,"children":9422},{"class":196,"line":827},[9423],{"type":20,"tag":194,"props":9424,"children":9425},{"style":201},[9426],{"type":30,"value":9427},"         * Something went wrong when opening our db. This could range from the user refusing the\n",{"type":20,"tag":194,"props":9429,"children":9430},{"class":196,"line":836},[9431],{"type":20,"tag":194,"props":9432,"children":9433},{"style":201},[9434],{"type":30,"value":9435},"         * request to allow this site to store data, to the current version of the db being higher\n",{"type":20,"tag":194,"props":9437,"children":9438},{"class":196,"line":844},[9439],{"type":20,"tag":194,"props":9440,"children":9441},{"style":201},[9442],{"type":30,"value":9443},"         * than the one we requested, to storage issues or lacking implementation.\n",{"type":20,"tag":194,"props":9445,"children":9446},{"class":196,"line":858},[9447,9452,9456],{"type":20,"tag":194,"props":9448,"children":9449},{"style":201},[9450],{"type":30,"value":9451},"         * ",{"type":20,"tag":194,"props":9453,"children":9454},{"style":252},[9455],{"type":30,"value":255},{"type":20,"tag":194,"props":9457,"children":9458},{"style":264},[9459],{"type":30,"value":9460}," event\n",{"type":20,"tag":194,"props":9462,"children":9463},{"class":196,"line":1726},[9464],{"type":20,"tag":194,"props":9465,"children":9466},{"style":201},[9467],{"type":30,"value":6313},{"type":20,"tag":194,"props":9469,"children":9470},{"class":196,"line":1743},[9471,9476,9481,9485,9489,9493,9498],{"type":20,"tag":194,"props":9472,"children":9473},{"style":264},[9474],{"type":30,"value":9475},"        dbreq.",{"type":20,"tag":194,"props":9477,"children":9478},{"style":258},[9479],{"type":30,"value":9480},"onerror",{"type":20,"tag":194,"props":9482,"children":9483},{"style":252},[9484],{"type":30,"value":3298},{"type":20,"tag":194,"props":9486,"children":9487},{"style":252},[9488],{"type":30,"value":3303},{"type":20,"tag":194,"props":9490,"children":9491},{"style":264},[9492],{"type":30,"value":403},{"type":20,"tag":194,"props":9494,"children":9495},{"style":406},[9496],{"type":30,"value":9497},"event",{"type":20,"tag":194,"props":9499,"children":9500},{"style":264},[9501],{"type":30,"value":4253},{"type":20,"tag":194,"props":9503,"children":9504},{"class":196,"line":1751},[9505,9509,9513],{"type":20,"tag":194,"props":9506,"children":9507},{"style":264},[9508],{"type":30,"value":791},{"type":20,"tag":194,"props":9510,"children":9511},{"style":258},[9512],{"type":30,"value":796},{"type":20,"tag":194,"props":9514,"children":9515},{"style":264},[9516],{"type":30,"value":9517},"(event);\n",{"type":20,"tag":194,"props":9519,"children":9520},{"class":196,"line":1776},[9521,9526,9530],{"type":20,"tag":194,"props":9522,"children":9523},{"style":264},[9524],{"type":30,"value":9525},"            dbReady.",{"type":20,"tag":194,"props":9527,"children":9528},{"style":258},[9529],{"type":30,"value":1186},{"type":20,"tag":194,"props":9531,"children":9532},{"style":264},[9533],{"type":30,"value":9517},{"type":20,"tag":194,"props":9535,"children":9536},{"class":196,"line":1811},[9537],{"type":20,"tag":194,"props":9538,"children":9539},{"style":264},[9540],{"type":30,"value":9541},"        };\n",{"type":20,"tag":194,"props":9543,"children":9544},{"class":196,"line":1847},[9545],{"type":20,"tag":194,"props":9546,"children":9547},{"emptyLinePlaceholder":546},[9548],{"type":30,"value":549},{"type":20,"tag":194,"props":9550,"children":9551},{"class":196,"line":1901},[9552],{"type":20,"tag":194,"props":9553,"children":9554},{"style":201},[9555],{"type":30,"value":6297},{"type":20,"tag":194,"props":9557,"children":9558},{"class":196,"line":1937},[9559],{"type":20,"tag":194,"props":9560,"children":9561},{"style":201},[9562],{"type":30,"value":9563},"         * The on upgrade needed event is called whenever we're opening a database with a version number\n",{"type":20,"tag":194,"props":9565,"children":9566},{"class":196,"line":1951},[9567],{"type":20,"tag":194,"props":9568,"children":9569},{"style":201},[9570],{"type":30,"value":9571},"         * higher than the currently existing version number, which includes when the database doesn't\n",{"type":20,"tag":194,"props":9573,"children":9574},{"class":196,"line":1959},[9575],{"type":20,"tag":194,"props":9576,"children":9577},{"style":201},[9578],{"type":30,"value":9579},"         * currently exist. Within this function we define the structure of the db.\n",{"type":20,"tag":194,"props":9581,"children":9582},{"class":196,"line":1991},[9583,9587,9591],{"type":20,"tag":194,"props":9584,"children":9585},{"style":201},[9586],{"type":30,"value":9451},{"type":20,"tag":194,"props":9588,"children":9589},{"style":252},[9590],{"type":30,"value":255},{"type":20,"tag":194,"props":9592,"children":9593},{"style":264},[9594],{"type":30,"value":9460},{"type":20,"tag":194,"props":9596,"children":9597},{"class":196,"line":2004},[9598],{"type":20,"tag":194,"props":9599,"children":9600},{"style":201},[9601],{"type":30,"value":6313},{"type":20,"tag":194,"props":9603,"children":9604},{"class":196,"line":2012},[9605,9609,9614,9618,9622,9626,9630],{"type":20,"tag":194,"props":9606,"children":9607},{"style":264},[9608],{"type":30,"value":9475},{"type":20,"tag":194,"props":9610,"children":9611},{"style":258},[9612],{"type":30,"value":9613},"onupgradeneeded",{"type":20,"tag":194,"props":9615,"children":9616},{"style":252},[9617],{"type":30,"value":3298},{"type":20,"tag":194,"props":9619,"children":9620},{"style":252},[9621],{"type":30,"value":3303},{"type":20,"tag":194,"props":9623,"children":9624},{"style":264},[9625],{"type":30,"value":403},{"type":20,"tag":194,"props":9627,"children":9628},{"style":406},[9629],{"type":30,"value":9497},{"type":20,"tag":194,"props":9631,"children":9632},{"style":264},[9633],{"type":30,"value":4253},{"type":20,"tag":194,"props":9635,"children":9636},{"class":196,"line":2020},[9637,9641],{"type":20,"tag":194,"props":9638,"children":9639},{"style":252},[9640],{"type":30,"value":7360},{"type":20,"tag":194,"props":9642,"children":9643},{"style":264},[9644],{"type":30,"value":9645}," objectStore;\n",{"type":20,"tag":194,"props":9647,"children":9648},{"class":196,"line":2028},[9649],{"type":20,"tag":194,"props":9650,"children":9651},{"emptyLinePlaceholder":546},[9652],{"type":30,"value":549},{"type":20,"tag":194,"props":9654,"children":9655},{"class":196,"line":2037},[9656,9661,9665],{"type":20,"tag":194,"props":9657,"children":9658},{"style":264},[9659],{"type":30,"value":9660},"            db ",{"type":20,"tag":194,"props":9662,"children":9663},{"style":252},[9664],{"type":30,"value":461},{"type":20,"tag":194,"props":9666,"children":9667},{"style":264},[9668],{"type":30,"value":9669}," event.target.result;\n",{"type":20,"tag":194,"props":9671,"children":9672},{"class":196,"line":2045},[9673,9678,9682,9686,9690,9694,9698],{"type":20,"tag":194,"props":9674,"children":9675},{"style":264},[9676],{"type":30,"value":9677},"            db.",{"type":20,"tag":194,"props":9679,"children":9680},{"style":258},[9681],{"type":30,"value":9480},{"type":20,"tag":194,"props":9683,"children":9684},{"style":252},[9685],{"type":30,"value":3298},{"type":20,"tag":194,"props":9687,"children":9688},{"style":252},[9689],{"type":30,"value":3303},{"type":20,"tag":194,"props":9691,"children":9692},{"style":264},[9693],{"type":30,"value":403},{"type":20,"tag":194,"props":9695,"children":9696},{"style":406},[9697],{"type":30,"value":9497},{"type":20,"tag":194,"props":9699,"children":9700},{"style":264},[9701],{"type":30,"value":4253},{"type":20,"tag":194,"props":9703,"children":9704},{"class":196,"line":2066},[9705,9709,9713],{"type":20,"tag":194,"props":9706,"children":9707},{"style":264},[9708],{"type":30,"value":2742},{"type":20,"tag":194,"props":9710,"children":9711},{"style":258},[9712],{"type":30,"value":796},{"type":20,"tag":194,"props":9714,"children":9715},{"style":264},[9716],{"type":30,"value":9517},{"type":20,"tag":194,"props":9718,"children":9719},{"class":196,"line":2087},[9720],{"type":20,"tag":194,"props":9721,"children":9722},{"style":264},[9723],{"type":30,"value":9724},"            };\n",{"type":20,"tag":194,"props":9726,"children":9727},{"class":196,"line":2095},[9728],{"type":20,"tag":194,"props":9729,"children":9730},{"emptyLinePlaceholder":546},[9731],{"type":30,"value":549},{"type":20,"tag":194,"props":9733,"children":9734},{"class":196,"line":2128},[9735,9740,9744,9749,9754,9758,9763,9768,9773],{"type":20,"tag":194,"props":9736,"children":9737},{"style":264},[9738],{"type":30,"value":9739},"            objectStore ",{"type":20,"tag":194,"props":9741,"children":9742},{"style":252},[9743],{"type":30,"value":461},{"type":20,"tag":194,"props":9745,"children":9746},{"style":264},[9747],{"type":30,"value":9748}," db.",{"type":20,"tag":194,"props":9750,"children":9751},{"style":258},[9752],{"type":30,"value":9753},"createObjectStore",{"type":20,"tag":194,"props":9755,"children":9756},{"style":264},[9757],{"type":30,"value":403},{"type":20,"tag":194,"props":9759,"children":9760},{"style":506},[9761],{"type":30,"value":9762},"\"jalicData\"",{"type":20,"tag":194,"props":9764,"children":9765},{"style":264},[9766],{"type":30,"value":9767},", {keyPath:",{"type":20,"tag":194,"props":9769,"children":9770},{"style":506},[9771],{"type":30,"value":9772},"\"jdName\"",{"type":20,"tag":194,"props":9774,"children":9775},{"style":264},[9776],{"type":30,"value":4204},{"type":20,"tag":194,"props":9778,"children":9779},{"class":196,"line":2147},[9780,9785,9790,9794,9799,9803,9807,9812,9817],{"type":20,"tag":194,"props":9781,"children":9782},{"style":264},[9783],{"type":30,"value":9784},"            objectStore.",{"type":20,"tag":194,"props":9786,"children":9787},{"style":258},[9788],{"type":30,"value":9789},"createIndex",{"type":20,"tag":194,"props":9791,"children":9792},{"style":264},[9793],{"type":30,"value":403},{"type":20,"tag":194,"props":9795,"children":9796},{"style":506},[9797],{"type":30,"value":9798},"\"storedAt\"",{"type":20,"tag":194,"props":9800,"children":9801},{"style":264},[9802],{"type":30,"value":414},{"type":20,"tag":194,"props":9804,"children":9805},{"style":506},[9806],{"type":30,"value":9798},{"type":20,"tag":194,"props":9808,"children":9809},{"style":264},[9810],{"type":30,"value":9811},", {unique:",{"type":20,"tag":194,"props":9813,"children":9814},{"style":680},[9815],{"type":30,"value":9816},"false",{"type":20,"tag":194,"props":9818,"children":9819},{"style":264},[9820],{"type":30,"value":4204},{"type":20,"tag":194,"props":9822,"children":9823},{"class":196,"line":2175},[9824],{"type":20,"tag":194,"props":9825,"children":9826},{"emptyLinePlaceholder":546},[9827],{"type":30,"value":549},{"type":20,"tag":194,"props":9829,"children":9830},{"class":196,"line":2203},[9831,9836,9841,9845,9849,9853,9857],{"type":20,"tag":194,"props":9832,"children":9833},{"style":264},[9834],{"type":30,"value":9835},"            objectStore.transaction.",{"type":20,"tag":194,"props":9837,"children":9838},{"style":258},[9839],{"type":30,"value":9840},"oncomplete",{"type":20,"tag":194,"props":9842,"children":9843},{"style":252},[9844],{"type":30,"value":3298},{"type":20,"tag":194,"props":9846,"children":9847},{"style":252},[9848],{"type":30,"value":3303},{"type":20,"tag":194,"props":9850,"children":9851},{"style":264},[9852],{"type":30,"value":403},{"type":20,"tag":194,"props":9854,"children":9855},{"style":406},[9856],{"type":30,"value":9497},{"type":20,"tag":194,"props":9858,"children":9859},{"style":264},[9860],{"type":30,"value":4253},{"type":20,"tag":194,"props":9862,"children":9863},{"class":196,"line":2211},[9864,9869,9873],{"type":20,"tag":194,"props":9865,"children":9866},{"style":264},[9867],{"type":30,"value":9868},"                dbReady.",{"type":20,"tag":194,"props":9870,"children":9871},{"style":258},[9872],{"type":30,"value":1177},{"type":20,"tag":194,"props":9874,"children":9875},{"style":264},[9876],{"type":30,"value":539},{"type":20,"tag":194,"props":9878,"children":9879},{"class":196,"line":2219},[9880],{"type":20,"tag":194,"props":9881,"children":9882},{"style":264},[9883],{"type":30,"value":9724},{"type":20,"tag":194,"props":9885,"children":9886},{"class":196,"line":2227},[9887],{"type":20,"tag":194,"props":9888,"children":9889},{"style":264},[9890],{"type":30,"value":9541},{"type":20,"tag":194,"props":9892,"children":9893},{"class":196,"line":2236},[9894],{"type":20,"tag":194,"props":9895,"children":9896},{"emptyLinePlaceholder":546},[9897],{"type":30,"value":549},{"type":20,"tag":194,"props":9899,"children":9900},{"class":196,"line":2245},[9901],{"type":20,"tag":194,"props":9902,"children":9903},{"style":201},[9904],{"type":30,"value":6297},{"type":20,"tag":194,"props":9906,"children":9907},{"class":196,"line":2254},[9908],{"type":20,"tag":194,"props":9909,"children":9910},{"style":201},[9911],{"type":30,"value":9912},"         * DB was opened successfully, with no upgrade needed.\n",{"type":20,"tag":194,"props":9914,"children":9915},{"class":196,"line":2262},[9916,9920,9924],{"type":20,"tag":194,"props":9917,"children":9918},{"style":201},[9919],{"type":30,"value":9451},{"type":20,"tag":194,"props":9921,"children":9922},{"style":252},[9923],{"type":30,"value":255},{"type":20,"tag":194,"props":9925,"children":9926},{"style":264},[9927],{"type":30,"value":9460},{"type":20,"tag":194,"props":9929,"children":9930},{"class":196,"line":2286},[9931],{"type":20,"tag":194,"props":9932,"children":9933},{"style":201},[9934],{"type":30,"value":6313},{"type":20,"tag":194,"props":9936,"children":9937},{"class":196,"line":2295},[9938,9942,9947,9951,9955,9959,9963],{"type":20,"tag":194,"props":9939,"children":9940},{"style":264},[9941],{"type":30,"value":9475},{"type":20,"tag":194,"props":9943,"children":9944},{"style":258},[9945],{"type":30,"value":9946},"onsuccess",{"type":20,"tag":194,"props":9948,"children":9949},{"style":252},[9950],{"type":30,"value":3298},{"type":20,"tag":194,"props":9952,"children":9953},{"style":252},[9954],{"type":30,"value":3303},{"type":20,"tag":194,"props":9956,"children":9957},{"style":264},[9958],{"type":30,"value":403},{"type":20,"tag":194,"props":9960,"children":9961},{"style":406},[9962],{"type":30,"value":9497},{"type":20,"tag":194,"props":9964,"children":9965},{"style":264},[9966],{"type":30,"value":4253},{"type":20,"tag":194,"props":9968,"children":9969},{"class":196,"line":2319},[9970,9974,9978],{"type":20,"tag":194,"props":9971,"children":9972},{"style":264},[9973],{"type":30,"value":9660},{"type":20,"tag":194,"props":9975,"children":9976},{"style":252},[9977],{"type":30,"value":461},{"type":20,"tag":194,"props":9979,"children":9980},{"style":264},[9981],{"type":30,"value":9669},{"type":20,"tag":194,"props":9983,"children":9984},{"class":196,"line":2328},[9985,9989,9993],{"type":20,"tag":194,"props":9986,"children":9987},{"style":264},[9988],{"type":30,"value":9525},{"type":20,"tag":194,"props":9990,"children":9991},{"style":258},[9992],{"type":30,"value":1177},{"type":20,"tag":194,"props":9994,"children":9995},{"style":264},[9996],{"type":30,"value":539},{"type":20,"tag":194,"props":9998,"children":9999},{"class":196,"line":2352},[10000],{"type":20,"tag":194,"props":10001,"children":10002},{"style":264},[10003],{"type":30,"value":9541},{"type":20,"tag":194,"props":10005,"children":10006},{"class":196,"line":2361},[10007],{"type":20,"tag":194,"props":10008,"children":10009},{"emptyLinePlaceholder":546},[10010],{"type":30,"value":549},{"type":20,"tag":194,"props":10012,"children":10013},{"class":196,"line":2381},[10014,10018,10023,10028],{"type":20,"tag":194,"props":10015,"children":10016},{"style":252},[10017],{"type":30,"value":1591},{"type":20,"tag":194,"props":10019,"children":10020},{"style":264},[10021],{"type":30,"value":10022}," dbReady.",{"type":20,"tag":194,"props":10024,"children":10025},{"style":258},[10026],{"type":30,"value":10027},"promise",{"type":20,"tag":194,"props":10029,"children":10030},{"style":264},[10031],{"type":30,"value":539},{"type":20,"tag":194,"props":10033,"children":10034},{"class":196,"line":2389},[10035],{"type":20,"tag":194,"props":10036,"children":10037},{"style":264},[10038],{"type":30,"value":1657},{"type":20,"tag":194,"props":10040,"children":10041},{"class":196,"line":2437},[10042],{"type":20,"tag":194,"props":10043,"children":10044},{"emptyLinePlaceholder":546},[10045],{"type":30,"value":549},{"type":20,"tag":194,"props":10047,"children":10048},{"class":196,"line":2465},[10049,10054],{"type":20,"tag":194,"props":10050,"children":10051},{"style":258},[10052],{"type":30,"value":10053},"    createDatabase",{"type":20,"tag":194,"props":10055,"children":10056},{"style":264},[10057],{"type":30,"value":10058},"(idb);\n",{"type":20,"tag":194,"props":10060,"children":10061},{"class":196,"line":2518},[10062],{"type":20,"tag":194,"props":10063,"children":10064},{"emptyLinePlaceholder":546},[10065],{"type":30,"value":549},{"type":20,"tag":194,"props":10067,"children":10068},{"class":196,"line":2526},[10069],{"type":20,"tag":194,"props":10070,"children":10071},{"style":201},[10072],{"type":30,"value":1399},{"type":20,"tag":194,"props":10074,"children":10075},{"class":196,"line":2567},[10076],{"type":20,"tag":194,"props":10077,"children":10078},{"style":201},[10079],{"type":30,"value":10080},"     * Define a simple interface mimicking the Storage interface on the jQuery object, with the major difference being\n",{"type":20,"tag":194,"props":10082,"children":10083},{"class":196,"line":2580},[10084],{"type":20,"tag":194,"props":10085,"children":10086},{"style":201},[10087],{"type":30,"value":10088},"     * everything executes asynchronously, and returns a $.Deferred object to account for that.\n",{"type":20,"tag":194,"props":10090,"children":10091},{"class":196,"line":2597},[10092],{"type":20,"tag":194,"props":10093,"children":10094},{"style":201},[10095],{"type":30,"value":1448},{"type":20,"tag":194,"props":10097,"children":10098},{"class":196,"line":2669},[10099,10104,10108],{"type":20,"tag":194,"props":10100,"children":10101},{"style":264},[10102],{"type":30,"value":10103},"    $.jidb ",{"type":20,"tag":194,"props":10105,"children":10106},{"style":252},[10107],{"type":30,"value":461},{"type":20,"tag":194,"props":10109,"children":10110},{"style":264},[10111],{"type":30,"value":595},{"type":20,"tag":194,"props":10113,"children":10114},{"class":196,"line":2697},[10115],{"type":20,"tag":194,"props":10116,"children":10117},{"style":201},[10118],{"type":30,"value":6297},{"type":20,"tag":194,"props":10120,"children":10121},{"class":196,"line":2714},[10122],{"type":20,"tag":194,"props":10123,"children":10124},{"style":201},[10125],{"type":30,"value":10126},"         * Set an item within the jalicData objectStore, using the given jdName and data, with optionally\n",{"type":20,"tag":194,"props":10128,"children":10129},{"class":196,"line":2723},[10130],{"type":20,"tag":194,"props":10131,"children":10132},{"style":201},[10133],{"type":30,"value":10134},"         * a dataType parameter to store alongside the data. If dataType is not provided, it is the result of\n",{"type":20,"tag":194,"props":10136,"children":10137},{"class":196,"line":2736},[10138],{"type":20,"tag":194,"props":10139,"children":10140},{"style":201},[10141],{"type":30,"value":10142},"         * typeof data.\n",{"type":20,"tag":194,"props":10144,"children":10145},{"class":196,"line":2765},[10146],{"type":20,"tag":194,"props":10147,"children":10148},{"style":201},[10149],{"type":30,"value":10150},"         * Notice that we 'put' data, rather than add it - that means we will always overwrite data with an\n",{"type":20,"tag":194,"props":10152,"children":10153},{"class":196,"line":2773},[10154],{"type":20,"tag":194,"props":10155,"children":10156},{"style":201},[10157],{"type":30,"value":10158},"         * identical key (jdName), if it already exists.\n",{"type":20,"tag":194,"props":10160,"children":10161},{"class":196,"line":2782},[10162,10166,10170],{"type":20,"tag":194,"props":10163,"children":10164},{"style":201},[10165],{"type":30,"value":9451},{"type":20,"tag":194,"props":10167,"children":10168},{"style":252},[10169],{"type":30,"value":255},{"type":20,"tag":194,"props":10171,"children":10172},{"style":264},[10173],{"type":30,"value":10174}," jdName\n",{"type":20,"tag":194,"props":10176,"children":10177},{"class":196,"line":2790},[10178,10182,10186],{"type":20,"tag":194,"props":10179,"children":10180},{"style":201},[10181],{"type":30,"value":9451},{"type":20,"tag":194,"props":10183,"children":10184},{"style":252},[10185],{"type":30,"value":255},{"type":20,"tag":194,"props":10187,"children":10188},{"style":264},[10189],{"type":30,"value":10190}," data\n",{"type":20,"tag":194,"props":10192,"children":10193},{"class":196,"line":2802},[10194,10198,10202],{"type":20,"tag":194,"props":10195,"children":10196},{"style":201},[10197],{"type":30,"value":9451},{"type":20,"tag":194,"props":10199,"children":10200},{"style":252},[10201],{"type":30,"value":255},{"type":20,"tag":194,"props":10203,"children":10204},{"style":264},[10205],{"type":30,"value":952},{"type":20,"tag":194,"props":10207,"children":10208},{"class":196,"line":2810},[10209,10213,10217,10222],{"type":20,"tag":194,"props":10210,"children":10211},{"style":201},[10212],{"type":30,"value":9451},{"type":20,"tag":194,"props":10214,"children":10215},{"style":252},[10216],{"type":30,"value":964},{"type":20,"tag":194,"props":10218,"children":10219},{"style":258},[10220],{"type":30,"value":10221}," {$.Deferred}",{"type":20,"tag":194,"props":10223,"children":10224},{"style":201},[10225],{"type":30,"value":10226}," Returns a jQuery Deferred object, which resolves with an empty body on success,\n",{"type":20,"tag":194,"props":10228,"children":10229},{"class":196,"line":2818},[10230],{"type":20,"tag":194,"props":10231,"children":10232},{"style":201},[10233],{"type":30,"value":10234},"         * or else resolves with the transaction or request error on failure.\n",{"type":20,"tag":194,"props":10236,"children":10237},{"class":196,"line":2826},[10238],{"type":20,"tag":194,"props":10239,"children":10240},{"style":201},[10241],{"type":30,"value":6313},{"type":20,"tag":194,"props":10243,"children":10244},{"class":196,"line":2835},[10245,10250,10254,10258,10262,10267,10271,10275,10279,10283],{"type":20,"tag":194,"props":10246,"children":10247},{"style":258},[10248],{"type":30,"value":10249},"        setItem",{"type":20,"tag":194,"props":10251,"children":10252},{"style":264},[10253],{"type":30,"value":1554},{"type":20,"tag":194,"props":10255,"children":10256},{"style":252},[10257],{"type":30,"value":393},{"type":20,"tag":194,"props":10259,"children":10260},{"style":264},[10261],{"type":30,"value":403},{"type":20,"tag":194,"props":10263,"children":10264},{"style":406},[10265],{"type":30,"value":10266},"jdName",{"type":20,"tag":194,"props":10268,"children":10269},{"style":264},[10270],{"type":30,"value":414},{"type":20,"tag":194,"props":10272,"children":10273},{"style":406},[10274],{"type":30,"value":4513},{"type":20,"tag":194,"props":10276,"children":10277},{"style":264},[10278],{"type":30,"value":414},{"type":20,"tag":194,"props":10280,"children":10281},{"style":406},[10282],{"type":30,"value":1006},{"type":20,"tag":194,"props":10284,"children":10285},{"style":264},[10286],{"type":30,"value":4253},{"type":20,"tag":194,"props":10288,"children":10289},{"class":196,"line":2844},[10290,10294,10299,10303,10307,10311],{"type":20,"tag":194,"props":10291,"children":10292},{"style":252},[10293],{"type":30,"value":7360},{"type":20,"tag":194,"props":10295,"children":10296},{"style":264},[10297],{"type":30,"value":10298}," defer ",{"type":20,"tag":194,"props":10300,"children":10301},{"style":252},[10302],{"type":30,"value":461},{"type":20,"tag":194,"props":10304,"children":10305},{"style":264},[10306],{"type":30,"value":9118},{"type":20,"tag":194,"props":10308,"children":10309},{"style":258},[10310],{"type":30,"value":9123},{"type":20,"tag":194,"props":10312,"children":10313},{"style":264},[10314],{"type":30,"value":476},{"type":20,"tag":194,"props":10316,"children":10317},{"class":196,"line":2852},[10318,10323,10327,10331,10336,10340,10344,10349,10354],{"type":20,"tag":194,"props":10319,"children":10320},{"style":264},[10321],{"type":30,"value":10322},"                transaction ",{"type":20,"tag":194,"props":10324,"children":10325},{"style":252},[10326],{"type":30,"value":461},{"type":20,"tag":194,"props":10328,"children":10329},{"style":264},[10330],{"type":30,"value":9748},{"type":20,"tag":194,"props":10332,"children":10333},{"style":258},[10334],{"type":30,"value":10335},"transaction",{"type":20,"tag":194,"props":10337,"children":10338},{"style":264},[10339],{"type":30,"value":5804},{"type":20,"tag":194,"props":10341,"children":10342},{"style":506},[10343],{"type":30,"value":9762},{"type":20,"tag":194,"props":10345,"children":10346},{"style":264},[10347],{"type":30,"value":10348},"], ",{"type":20,"tag":194,"props":10350,"children":10351},{"style":506},[10352],{"type":30,"value":10353},"\"readwrite\"",{"type":20,"tag":194,"props":10355,"children":10356},{"style":264},[10357],{"type":30,"value":5651},{"type":20,"tag":194,"props":10359,"children":10360},{"class":196,"line":2868},[10361,10366,10370,10375,10380,10384,10388],{"type":20,"tag":194,"props":10362,"children":10363},{"style":264},[10364],{"type":30,"value":10365},"                objectStore ",{"type":20,"tag":194,"props":10367,"children":10368},{"style":252},[10369],{"type":30,"value":461},{"type":20,"tag":194,"props":10371,"children":10372},{"style":264},[10373],{"type":30,"value":10374}," transaction.",{"type":20,"tag":194,"props":10376,"children":10377},{"style":258},[10378],{"type":30,"value":10379},"objectStore",{"type":20,"tag":194,"props":10381,"children":10382},{"style":264},[10383],{"type":30,"value":403},{"type":20,"tag":194,"props":10385,"children":10386},{"style":506},[10387],{"type":30,"value":9762},{"type":20,"tag":194,"props":10389,"children":10390},{"style":264},[10391],{"type":30,"value":5651},{"type":20,"tag":194,"props":10393,"children":10394},{"class":196,"line":2884},[10395],{"type":20,"tag":194,"props":10396,"children":10397},{"style":264},[10398],{"type":30,"value":10399},"                request;\n",{"type":20,"tag":194,"props":10401,"children":10402},{"class":196,"line":2900},[10403],{"type":20,"tag":194,"props":10404,"children":10405},{"emptyLinePlaceholder":546},[10406],{"type":30,"value":549},{"type":20,"tag":194,"props":10408,"children":10409},{"class":196,"line":2908},[10410,10414,10418,10423,10427,10431],{"type":20,"tag":194,"props":10411,"children":10412},{"style":264},[10413],{"type":30,"value":2471},{"type":20,"tag":194,"props":10415,"children":10416},{"style":252},[10417],{"type":30,"value":461},{"type":20,"tag":194,"props":10419,"children":10420},{"style":264},[10421],{"type":30,"value":10422}," dataType ",{"type":20,"tag":194,"props":10424,"children":10425},{"style":252},[10426],{"type":30,"value":519},{"type":20,"tag":194,"props":10428,"children":10429},{"style":252},[10430],{"type":30,"value":3564},{"type":20,"tag":194,"props":10432,"children":10433},{"style":264},[10434],{"type":30,"value":10435}," data;\n",{"type":20,"tag":194,"props":10437,"children":10438},{"class":196,"line":2940},[10439],{"type":20,"tag":194,"props":10440,"children":10441},{"emptyLinePlaceholder":546},[10442],{"type":30,"value":549},{"type":20,"tag":194,"props":10444,"children":10445},{"class":196,"line":2968},[10446,10451,10455,10459,10463],{"type":20,"tag":194,"props":10447,"children":10448},{"style":264},[10449],{"type":30,"value":10450},"            transaction.",{"type":20,"tag":194,"props":10452,"children":10453},{"style":258},[10454],{"type":30,"value":9840},{"type":20,"tag":194,"props":10456,"children":10457},{"style":252},[10458],{"type":30,"value":3298},{"type":20,"tag":194,"props":10460,"children":10461},{"style":252},[10462],{"type":30,"value":3303},{"type":20,"tag":194,"props":10464,"children":10465},{"style":264},[10466],{"type":30,"value":4121},{"type":20,"tag":194,"props":10468,"children":10469},{"class":196,"line":2977},[10470,10475,10480,10484],{"type":20,"tag":194,"props":10471,"children":10472},{"style":252},[10473],{"type":30,"value":10474},"                return",{"type":20,"tag":194,"props":10476,"children":10477},{"style":264},[10478],{"type":30,"value":10479}," defer.",{"type":20,"tag":194,"props":10481,"children":10482},{"style":258},[10483],{"type":30,"value":1177},{"type":20,"tag":194,"props":10485,"children":10486},{"style":264},[10487],{"type":30,"value":539},{"type":20,"tag":194,"props":10489,"children":10490},{"class":196,"line":2986},[10491],{"type":20,"tag":194,"props":10492,"children":10493},{"style":264},[10494],{"type":30,"value":9724},{"type":20,"tag":194,"props":10496,"children":10497},{"class":196,"line":3003},[10498],{"type":20,"tag":194,"props":10499,"children":10500},{"emptyLinePlaceholder":546},[10501],{"type":30,"value":549},{"type":20,"tag":194,"props":10503,"children":10504},{"class":196,"line":3020},[10505,10509,10513,10517,10521,10525,10529],{"type":20,"tag":194,"props":10506,"children":10507},{"style":264},[10508],{"type":30,"value":10450},{"type":20,"tag":194,"props":10510,"children":10511},{"style":258},[10512],{"type":30,"value":9480},{"type":20,"tag":194,"props":10514,"children":10515},{"style":252},[10516],{"type":30,"value":3298},{"type":20,"tag":194,"props":10518,"children":10519},{"style":252},[10520],{"type":30,"value":3303},{"type":20,"tag":194,"props":10522,"children":10523},{"style":264},[10524],{"type":30,"value":403},{"type":20,"tag":194,"props":10526,"children":10527},{"style":406},[10528],{"type":30,"value":9497},{"type":20,"tag":194,"props":10530,"children":10531},{"style":264},[10532],{"type":30,"value":4253},{"type":20,"tag":194,"props":10534,"children":10535},{"class":196,"line":3029},[10536,10540,10544],{"type":20,"tag":194,"props":10537,"children":10538},{"style":264},[10539],{"type":30,"value":2742},{"type":20,"tag":194,"props":10541,"children":10542},{"style":258},[10543],{"type":30,"value":796},{"type":20,"tag":194,"props":10545,"children":10546},{"style":264},[10547],{"type":30,"value":9517},{"type":20,"tag":194,"props":10549,"children":10550},{"class":196,"line":3042},[10551,10555,10559,10563],{"type":20,"tag":194,"props":10552,"children":10553},{"style":252},[10554],{"type":30,"value":10474},{"type":20,"tag":194,"props":10556,"children":10557},{"style":264},[10558],{"type":30,"value":10479},{"type":20,"tag":194,"props":10560,"children":10561},{"style":258},[10562],{"type":30,"value":1186},{"type":20,"tag":194,"props":10564,"children":10565},{"style":264},[10566],{"type":30,"value":9517},{"type":20,"tag":194,"props":10568,"children":10569},{"class":196,"line":3051},[10570],{"type":20,"tag":194,"props":10571,"children":10572},{"style":264},[10573],{"type":30,"value":9724},{"type":20,"tag":194,"props":10575,"children":10576},{"class":196,"line":3059},[10577],{"type":20,"tag":194,"props":10578,"children":10579},{"emptyLinePlaceholder":546},[10580],{"type":30,"value":549},{"type":20,"tag":194,"props":10582,"children":10583},{"class":196,"line":3068},[10584,10589,10593,10598,10603,10608,10612,10616],{"type":20,"tag":194,"props":10585,"children":10586},{"style":264},[10587],{"type":30,"value":10588},"            request ",{"type":20,"tag":194,"props":10590,"children":10591},{"style":252},[10592],{"type":30,"value":461},{"type":20,"tag":194,"props":10594,"children":10595},{"style":264},[10596],{"type":30,"value":10597}," objectStore.",{"type":20,"tag":194,"props":10599,"children":10600},{"style":258},[10601],{"type":30,"value":10602},"put",{"type":20,"tag":194,"props":10604,"children":10605},{"style":264},[10606],{"type":30,"value":10607},"({jdName:jdName, storedAt:",{"type":20,"tag":194,"props":10609,"children":10610},{"style":252},[10611],{"type":30,"value":663},{"type":20,"tag":194,"props":10613,"children":10614},{"style":258},[10615],{"type":30,"value":668},{"type":20,"tag":194,"props":10617,"children":10618},{"style":264},[10619],{"type":30,"value":10620},"(), dataType:dataType, data:data});\n",{"type":20,"tag":194,"props":10622,"children":10623},{"class":196,"line":3076},[10624],{"type":20,"tag":194,"props":10625,"children":10626},{"emptyLinePlaceholder":546},[10627],{"type":30,"value":549},{"type":20,"tag":194,"props":10629,"children":10630},{"class":196,"line":3120},[10631,10636,10640,10644,10648,10652,10656],{"type":20,"tag":194,"props":10632,"children":10633},{"style":264},[10634],{"type":30,"value":10635},"            request.",{"type":20,"tag":194,"props":10637,"children":10638},{"style":258},[10639],{"type":30,"value":9480},{"type":20,"tag":194,"props":10641,"children":10642},{"style":252},[10643],{"type":30,"value":3298},{"type":20,"tag":194,"props":10645,"children":10646},{"style":252},[10647],{"type":30,"value":3303},{"type":20,"tag":194,"props":10649,"children":10650},{"style":264},[10651],{"type":30,"value":403},{"type":20,"tag":194,"props":10653,"children":10654},{"style":406},[10655],{"type":30,"value":9497},{"type":20,"tag":194,"props":10657,"children":10658},{"style":264},[10659],{"type":30,"value":4253},{"type":20,"tag":194,"props":10661,"children":10662},{"class":196,"line":3133},[10663,10667,10671],{"type":20,"tag":194,"props":10664,"children":10665},{"style":264},[10666],{"type":30,"value":2742},{"type":20,"tag":194,"props":10668,"children":10669},{"style":258},[10670],{"type":30,"value":796},{"type":20,"tag":194,"props":10672,"children":10673},{"style":264},[10674],{"type":30,"value":9517},{"type":20,"tag":194,"props":10676,"children":10677},{"class":196,"line":3141},[10678,10683,10687],{"type":20,"tag":194,"props":10679,"children":10680},{"style":264},[10681],{"type":30,"value":10682},"                defer.",{"type":20,"tag":194,"props":10684,"children":10685},{"style":258},[10686],{"type":30,"value":1186},{"type":20,"tag":194,"props":10688,"children":10689},{"style":264},[10690],{"type":30,"value":9517},{"type":20,"tag":194,"props":10692,"children":10693},{"class":196,"line":3149},[10694],{"type":20,"tag":194,"props":10695,"children":10696},{"style":264},[10697],{"type":30,"value":9724},{"type":20,"tag":194,"props":10699,"children":10700},{"class":196,"line":3157},[10701],{"type":20,"tag":194,"props":10702,"children":10703},{"emptyLinePlaceholder":546},[10704],{"type":30,"value":549},{"type":20,"tag":194,"props":10706,"children":10707},{"class":196,"line":3165},[10708,10712,10716,10720],{"type":20,"tag":194,"props":10709,"children":10710},{"style":252},[10711],{"type":30,"value":1943},{"type":20,"tag":194,"props":10713,"children":10714},{"style":264},[10715],{"type":30,"value":10479},{"type":20,"tag":194,"props":10717,"children":10718},{"style":258},[10719],{"type":30,"value":10027},{"type":20,"tag":194,"props":10721,"children":10722},{"style":264},[10723],{"type":30,"value":539},{"type":20,"tag":194,"props":10725,"children":10726},{"class":196,"line":3174},[10727],{"type":20,"tag":194,"props":10728,"children":10729},{"style":264},[10730],{"type":30,"value":10731},"        },\n",{"type":20,"tag":194,"props":10733,"children":10734},{"class":196,"line":3183},[10735],{"type":20,"tag":194,"props":10736,"children":10737},{"style":201},[10738],{"type":30,"value":6297},{"type":20,"tag":194,"props":10740,"children":10741},{"class":196,"line":3192},[10742],{"type":20,"tag":194,"props":10743,"children":10744},{"style":201},[10745],{"type":30,"value":10746},"         * Retrieve an item from the jalicData objectStore, using the given jdName as the key.\n",{"type":20,"tag":194,"props":10748,"children":10749},{"class":196,"line":3206},[10750,10754,10758],{"type":20,"tag":194,"props":10751,"children":10752},{"style":201},[10753],{"type":30,"value":9451},{"type":20,"tag":194,"props":10755,"children":10756},{"style":252},[10757],{"type":30,"value":255},{"type":20,"tag":194,"props":10759,"children":10760},{"style":264},[10761],{"type":30,"value":10174},{"type":20,"tag":194,"props":10763,"children":10764},{"class":196,"line":3215},[10765,10769,10773,10777],{"type":20,"tag":194,"props":10766,"children":10767},{"style":201},[10768],{"type":30,"value":9451},{"type":20,"tag":194,"props":10770,"children":10771},{"style":252},[10772],{"type":30,"value":964},{"type":20,"tag":194,"props":10774,"children":10775},{"style":258},[10776],{"type":30,"value":10221},{"type":20,"tag":194,"props":10778,"children":10779},{"style":201},[10780],{"type":30,"value":10781}," Returns a jQuery Deferred object, which resolves with the request result as an object\n",{"type":20,"tag":194,"props":10783,"children":10784},{"class":196,"line":3224},[10785],{"type":20,"tag":194,"props":10786,"children":10787},{"style":201},[10788],{"type":30,"value":10789},"         * on success, or else resolves with the transaction or request error on failure.\n",{"type":20,"tag":194,"props":10791,"children":10792},{"class":196,"line":3238},[10793],{"type":20,"tag":194,"props":10794,"children":10795},{"style":201},[10796],{"type":30,"value":6313},{"type":20,"tag":194,"props":10798,"children":10799},{"class":196,"line":3247},[10800,10805,10809,10813,10817,10821],{"type":20,"tag":194,"props":10801,"children":10802},{"style":258},[10803],{"type":30,"value":10804},"        getItem",{"type":20,"tag":194,"props":10806,"children":10807},{"style":264},[10808],{"type":30,"value":1554},{"type":20,"tag":194,"props":10810,"children":10811},{"style":252},[10812],{"type":30,"value":393},{"type":20,"tag":194,"props":10814,"children":10815},{"style":264},[10816],{"type":30,"value":403},{"type":20,"tag":194,"props":10818,"children":10819},{"style":406},[10820],{"type":30,"value":10266},{"type":20,"tag":194,"props":10822,"children":10823},{"style":264},[10824],{"type":30,"value":4253},{"type":20,"tag":194,"props":10826,"children":10827},{"class":196,"line":3261},[10828,10832,10836,10840,10844,10848],{"type":20,"tag":194,"props":10829,"children":10830},{"style":252},[10831],{"type":30,"value":7360},{"type":20,"tag":194,"props":10833,"children":10834},{"style":264},[10835],{"type":30,"value":10298},{"type":20,"tag":194,"props":10837,"children":10838},{"style":252},[10839],{"type":30,"value":461},{"type":20,"tag":194,"props":10841,"children":10842},{"style":264},[10843],{"type":30,"value":9118},{"type":20,"tag":194,"props":10845,"children":10846},{"style":258},[10847],{"type":30,"value":9123},{"type":20,"tag":194,"props":10849,"children":10850},{"style":264},[10851],{"type":30,"value":476},{"type":20,"tag":194,"props":10853,"children":10854},{"class":196,"line":3275},[10855,10859,10863,10867,10871,10875,10879,10883,10888],{"type":20,"tag":194,"props":10856,"children":10857},{"style":264},[10858],{"type":30,"value":10322},{"type":20,"tag":194,"props":10860,"children":10861},{"style":252},[10862],{"type":30,"value":461},{"type":20,"tag":194,"props":10864,"children":10865},{"style":264},[10866],{"type":30,"value":9748},{"type":20,"tag":194,"props":10868,"children":10869},{"style":258},[10870],{"type":30,"value":10335},{"type":20,"tag":194,"props":10872,"children":10873},{"style":264},[10874],{"type":30,"value":5804},{"type":20,"tag":194,"props":10876,"children":10877},{"style":506},[10878],{"type":30,"value":9762},{"type":20,"tag":194,"props":10880,"children":10881},{"style":264},[10882],{"type":30,"value":10348},{"type":20,"tag":194,"props":10884,"children":10885},{"style":506},[10886],{"type":30,"value":10887},"\"readonly\"",{"type":20,"tag":194,"props":10889,"children":10890},{"style":264},[10891],{"type":30,"value":5651},{"type":20,"tag":194,"props":10893,"children":10894},{"class":196,"line":3283},[10895,10899,10903,10907,10911,10915,10919],{"type":20,"tag":194,"props":10896,"children":10897},{"style":264},[10898],{"type":30,"value":10365},{"type":20,"tag":194,"props":10900,"children":10901},{"style":252},[10902],{"type":30,"value":461},{"type":20,"tag":194,"props":10904,"children":10905},{"style":264},[10906],{"type":30,"value":10374},{"type":20,"tag":194,"props":10908,"children":10909},{"style":258},[10910],{"type":30,"value":10379},{"type":20,"tag":194,"props":10912,"children":10913},{"style":264},[10914],{"type":30,"value":403},{"type":20,"tag":194,"props":10916,"children":10917},{"style":506},[10918],{"type":30,"value":9762},{"type":20,"tag":194,"props":10920,"children":10921},{"style":264},[10922],{"type":30,"value":5651},{"type":20,"tag":194,"props":10924,"children":10925},{"class":196,"line":3326},[10926,10931,10935,10939,10943],{"type":20,"tag":194,"props":10927,"children":10928},{"style":264},[10929],{"type":30,"value":10930},"                request ",{"type":20,"tag":194,"props":10932,"children":10933},{"style":252},[10934],{"type":30,"value":461},{"type":20,"tag":194,"props":10936,"children":10937},{"style":264},[10938],{"type":30,"value":10597},{"type":20,"tag":194,"props":10940,"children":10941},{"style":258},[10942],{"type":30,"value":499},{"type":20,"tag":194,"props":10944,"children":10945},{"style":264},[10946],{"type":30,"value":10947},"(jdName);\n",{"type":20,"tag":194,"props":10949,"children":10950},{"class":196,"line":3351},[10951],{"type":20,"tag":194,"props":10952,"children":10953},{"emptyLinePlaceholder":546},[10954],{"type":30,"value":549},{"type":20,"tag":194,"props":10956,"children":10957},{"class":196,"line":3382},[10958,10962,10966,10970,10974,10978,10982],{"type":20,"tag":194,"props":10959,"children":10960},{"style":264},[10961],{"type":30,"value":10635},{"type":20,"tag":194,"props":10963,"children":10964},{"style":258},[10965],{"type":30,"value":9480},{"type":20,"tag":194,"props":10967,"children":10968},{"style":252},[10969],{"type":30,"value":3298},{"type":20,"tag":194,"props":10971,"children":10972},{"style":252},[10973],{"type":30,"value":3303},{"type":20,"tag":194,"props":10975,"children":10976},{"style":264},[10977],{"type":30,"value":403},{"type":20,"tag":194,"props":10979,"children":10980},{"style":406},[10981],{"type":30,"value":9497},{"type":20,"tag":194,"props":10983,"children":10984},{"style":264},[10985],{"type":30,"value":4253},{"type":20,"tag":194,"props":10987,"children":10988},{"class":196,"line":3404},[10989,10993,10997],{"type":20,"tag":194,"props":10990,"children":10991},{"style":264},[10992],{"type":30,"value":2742},{"type":20,"tag":194,"props":10994,"children":10995},{"style":258},[10996],{"type":30,"value":796},{"type":20,"tag":194,"props":10998,"children":10999},{"style":264},[11000],{"type":30,"value":9517},{"type":20,"tag":194,"props":11002,"children":11003},{"class":196,"line":3422},[11004,11008,11012],{"type":20,"tag":194,"props":11005,"children":11006},{"style":264},[11007],{"type":30,"value":10682},{"type":20,"tag":194,"props":11009,"children":11010},{"style":258},[11011],{"type":30,"value":1186},{"type":20,"tag":194,"props":11013,"children":11014},{"style":264},[11015],{"type":30,"value":9517},{"type":20,"tag":194,"props":11017,"children":11018},{"class":196,"line":3431},[11019],{"type":20,"tag":194,"props":11020,"children":11021},{"style":264},[11022],{"type":30,"value":9724},{"type":20,"tag":194,"props":11024,"children":11025},{"class":196,"line":3439},[11026],{"type":20,"tag":194,"props":11027,"children":11028},{"emptyLinePlaceholder":546},[11029],{"type":30,"value":549},{"type":20,"tag":194,"props":11031,"children":11032},{"class":196,"line":3448},[11033,11037,11041,11045,11049,11053,11057],{"type":20,"tag":194,"props":11034,"children":11035},{"style":264},[11036],{"type":30,"value":10635},{"type":20,"tag":194,"props":11038,"children":11039},{"style":258},[11040],{"type":30,"value":9946},{"type":20,"tag":194,"props":11042,"children":11043},{"style":252},[11044],{"type":30,"value":3298},{"type":20,"tag":194,"props":11046,"children":11047},{"style":252},[11048],{"type":30,"value":3303},{"type":20,"tag":194,"props":11050,"children":11051},{"style":264},[11052],{"type":30,"value":403},{"type":20,"tag":194,"props":11054,"children":11055},{"style":406},[11056],{"type":30,"value":9497},{"type":20,"tag":194,"props":11058,"children":11059},{"style":264},[11060],{"type":30,"value":4253},{"type":20,"tag":194,"props":11062,"children":11063},{"class":196,"line":3456},[11064,11068,11072],{"type":20,"tag":194,"props":11065,"children":11066},{"style":264},[11067],{"type":30,"value":10682},{"type":20,"tag":194,"props":11069,"children":11070},{"style":258},[11071],{"type":30,"value":1177},{"type":20,"tag":194,"props":11073,"children":11074},{"style":264},[11075],{"type":30,"value":11076},"(request.result);\n",{"type":20,"tag":194,"props":11078,"children":11079},{"class":196,"line":3490},[11080],{"type":20,"tag":194,"props":11081,"children":11082},{"style":264},[11083],{"type":30,"value":9724},{"type":20,"tag":194,"props":11085,"children":11086},{"class":196,"line":3498},[11087],{"type":20,"tag":194,"props":11088,"children":11089},{"emptyLinePlaceholder":546},[11090],{"type":30,"value":549},{"type":20,"tag":194,"props":11092,"children":11093},{"class":196,"line":3537},[11094,11098,11102,11106],{"type":20,"tag":194,"props":11095,"children":11096},{"style":252},[11097],{"type":30,"value":1943},{"type":20,"tag":194,"props":11099,"children":11100},{"style":264},[11101],{"type":30,"value":10479},{"type":20,"tag":194,"props":11103,"children":11104},{"style":258},[11105],{"type":30,"value":10027},{"type":20,"tag":194,"props":11107,"children":11108},{"style":264},[11109],{"type":30,"value":539},{"type":20,"tag":194,"props":11111,"children":11112},{"class":196,"line":3545},[11113],{"type":20,"tag":194,"props":11114,"children":11115},{"style":264},[11116],{"type":30,"value":10731},{"type":20,"tag":194,"props":11118,"children":11119},{"class":196,"line":3600},[11120],{"type":20,"tag":194,"props":11121,"children":11122},{"style":201},[11123],{"type":30,"value":6297},{"type":20,"tag":194,"props":11125,"children":11126},{"class":196,"line":3612},[11127],{"type":20,"tag":194,"props":11128,"children":11129},{"style":201},[11130],{"type":30,"value":11131},"         * Remove an item from the jalicData objectStore, using the given jdName as the key.\n",{"type":20,"tag":194,"props":11133,"children":11134},{"class":196,"line":3634},[11135,11139,11143],{"type":20,"tag":194,"props":11136,"children":11137},{"style":201},[11138],{"type":30,"value":9451},{"type":20,"tag":194,"props":11140,"children":11141},{"style":252},[11142],{"type":30,"value":255},{"type":20,"tag":194,"props":11144,"children":11145},{"style":264},[11146],{"type":30,"value":10174},{"type":20,"tag":194,"props":11148,"children":11149},{"class":196,"line":3642},[11150,11154,11158,11162],{"type":20,"tag":194,"props":11151,"children":11152},{"style":201},[11153],{"type":30,"value":9451},{"type":20,"tag":194,"props":11155,"children":11156},{"style":252},[11157],{"type":30,"value":964},{"type":20,"tag":194,"props":11159,"children":11160},{"style":258},[11161],{"type":30,"value":10221},{"type":20,"tag":194,"props":11163,"children":11164},{"style":201},[11165],{"type":30,"value":10226},{"type":20,"tag":194,"props":11167,"children":11168},{"class":196,"line":3650},[11169],{"type":20,"tag":194,"props":11170,"children":11171},{"style":201},[11172],{"type":30,"value":10234},{"type":20,"tag":194,"props":11174,"children":11175},{"class":196,"line":3690},[11176],{"type":20,"tag":194,"props":11177,"children":11178},{"style":201},[11179],{"type":30,"value":6313},{"type":20,"tag":194,"props":11181,"children":11182},{"class":196,"line":3702},[11183,11188,11192,11196,11200,11204],{"type":20,"tag":194,"props":11184,"children":11185},{"style":258},[11186],{"type":30,"value":11187},"        removeItem",{"type":20,"tag":194,"props":11189,"children":11190},{"style":264},[11191],{"type":30,"value":1554},{"type":20,"tag":194,"props":11193,"children":11194},{"style":252},[11195],{"type":30,"value":393},{"type":20,"tag":194,"props":11197,"children":11198},{"style":264},[11199],{"type":30,"value":403},{"type":20,"tag":194,"props":11201,"children":11202},{"style":406},[11203],{"type":30,"value":10266},{"type":20,"tag":194,"props":11205,"children":11206},{"style":264},[11207],{"type":30,"value":4253},{"type":20,"tag":194,"props":11209,"children":11210},{"class":196,"line":3710},[11211,11215,11219,11223,11227,11231],{"type":20,"tag":194,"props":11212,"children":11213},{"style":252},[11214],{"type":30,"value":7360},{"type":20,"tag":194,"props":11216,"children":11217},{"style":264},[11218],{"type":30,"value":10298},{"type":20,"tag":194,"props":11220,"children":11221},{"style":252},[11222],{"type":30,"value":461},{"type":20,"tag":194,"props":11224,"children":11225},{"style":264},[11226],{"type":30,"value":9118},{"type":20,"tag":194,"props":11228,"children":11229},{"style":258},[11230],{"type":30,"value":9123},{"type":20,"tag":194,"props":11232,"children":11233},{"style":264},[11234],{"type":30,"value":476},{"type":20,"tag":194,"props":11236,"children":11237},{"class":196,"line":3718},[11238,11242,11246,11250,11254,11258,11262,11266,11270],{"type":20,"tag":194,"props":11239,"children":11240},{"style":264},[11241],{"type":30,"value":10322},{"type":20,"tag":194,"props":11243,"children":11244},{"style":252},[11245],{"type":30,"value":461},{"type":20,"tag":194,"props":11247,"children":11248},{"style":264},[11249],{"type":30,"value":9748},{"type":20,"tag":194,"props":11251,"children":11252},{"style":258},[11253],{"type":30,"value":10335},{"type":20,"tag":194,"props":11255,"children":11256},{"style":264},[11257],{"type":30,"value":5804},{"type":20,"tag":194,"props":11259,"children":11260},{"style":506},[11261],{"type":30,"value":9762},{"type":20,"tag":194,"props":11263,"children":11264},{"style":264},[11265],{"type":30,"value":10348},{"type":20,"tag":194,"props":11267,"children":11268},{"style":506},[11269],{"type":30,"value":10353},{"type":20,"tag":194,"props":11271,"children":11272},{"style":264},[11273],{"type":30,"value":5651},{"type":20,"tag":194,"props":11275,"children":11276},{"class":196,"line":3743},[11277,11281,11285,11289,11293,11297,11301],{"type":20,"tag":194,"props":11278,"children":11279},{"style":264},[11280],{"type":30,"value":10365},{"type":20,"tag":194,"props":11282,"children":11283},{"style":252},[11284],{"type":30,"value":461},{"type":20,"tag":194,"props":11286,"children":11287},{"style":264},[11288],{"type":30,"value":10374},{"type":20,"tag":194,"props":11290,"children":11291},{"style":258},[11292],{"type":30,"value":10379},{"type":20,"tag":194,"props":11294,"children":11295},{"style":264},[11296],{"type":30,"value":403},{"type":20,"tag":194,"props":11298,"children":11299},{"style":506},[11300],{"type":30,"value":9762},{"type":20,"tag":194,"props":11302,"children":11303},{"style":264},[11304],{"type":30,"value":5651},{"type":20,"tag":194,"props":11306,"children":11307},{"class":196,"line":3751},[11308,11312,11316,11320,11325],{"type":20,"tag":194,"props":11309,"children":11310},{"style":264},[11311],{"type":30,"value":10930},{"type":20,"tag":194,"props":11313,"children":11314},{"style":252},[11315],{"type":30,"value":461},{"type":20,"tag":194,"props":11317,"children":11318},{"style":264},[11319],{"type":30,"value":10597},{"type":20,"tag":194,"props":11321,"children":11322},{"style":258},[11323],{"type":30,"value":11324},"delete",{"type":20,"tag":194,"props":11326,"children":11327},{"style":264},[11328],{"type":30,"value":10947},{"type":20,"tag":194,"props":11330,"children":11331},{"class":196,"line":3772},[11332],{"type":20,"tag":194,"props":11333,"children":11334},{"emptyLinePlaceholder":546},[11335],{"type":30,"value":549},{"type":20,"tag":194,"props":11337,"children":11338},{"class":196,"line":3781},[11339,11343,11347,11351,11355,11359,11363],{"type":20,"tag":194,"props":11340,"children":11341},{"style":264},[11342],{"type":30,"value":10635},{"type":20,"tag":194,"props":11344,"children":11345},{"style":258},[11346],{"type":30,"value":9480},{"type":20,"tag":194,"props":11348,"children":11349},{"style":252},[11350],{"type":30,"value":3298},{"type":20,"tag":194,"props":11352,"children":11353},{"style":252},[11354],{"type":30,"value":3303},{"type":20,"tag":194,"props":11356,"children":11357},{"style":264},[11358],{"type":30,"value":403},{"type":20,"tag":194,"props":11360,"children":11361},{"style":406},[11362],{"type":30,"value":9497},{"type":20,"tag":194,"props":11364,"children":11365},{"style":264},[11366],{"type":30,"value":4253},{"type":20,"tag":194,"props":11368,"children":11369},{"class":196,"line":3790},[11370,11374,11378],{"type":20,"tag":194,"props":11371,"children":11372},{"style":264},[11373],{"type":30,"value":2742},{"type":20,"tag":194,"props":11375,"children":11376},{"style":258},[11377],{"type":30,"value":796},{"type":20,"tag":194,"props":11379,"children":11380},{"style":264},[11381],{"type":30,"value":9517},{"type":20,"tag":194,"props":11383,"children":11384},{"class":196,"line":3835},[11385,11389,11393],{"type":20,"tag":194,"props":11386,"children":11387},{"style":264},[11388],{"type":30,"value":10682},{"type":20,"tag":194,"props":11390,"children":11391},{"style":258},[11392],{"type":30,"value":1186},{"type":20,"tag":194,"props":11394,"children":11395},{"style":264},[11396],{"type":30,"value":9517},{"type":20,"tag":194,"props":11398,"children":11399},{"class":196,"line":3843},[11400],{"type":20,"tag":194,"props":11401,"children":11402},{"style":264},[11403],{"type":30,"value":9724},{"type":20,"tag":194,"props":11405,"children":11406},{"class":196,"line":3851},[11407],{"type":20,"tag":194,"props":11408,"children":11409},{"emptyLinePlaceholder":546},[11410],{"type":30,"value":549},{"type":20,"tag":194,"props":11412,"children":11413},{"class":196,"line":3860},[11414,11418,11422,11426,11430],{"type":20,"tag":194,"props":11415,"children":11416},{"style":264},[11417],{"type":30,"value":10635},{"type":20,"tag":194,"props":11419,"children":11420},{"style":258},[11421],{"type":30,"value":9946},{"type":20,"tag":194,"props":11423,"children":11424},{"style":252},[11425],{"type":30,"value":3298},{"type":20,"tag":194,"props":11427,"children":11428},{"style":252},[11429],{"type":30,"value":3303},{"type":20,"tag":194,"props":11431,"children":11432},{"style":264},[11433],{"type":30,"value":4121},{"type":20,"tag":194,"props":11435,"children":11436},{"class":196,"line":3869},[11437,11441,11445],{"type":20,"tag":194,"props":11438,"children":11439},{"style":264},[11440],{"type":30,"value":10682},{"type":20,"tag":194,"props":11442,"children":11443},{"style":258},[11444],{"type":30,"value":1177},{"type":20,"tag":194,"props":11446,"children":11447},{"style":264},[11448],{"type":30,"value":539},{"type":20,"tag":194,"props":11450,"children":11451},{"class":196,"line":3917},[11452],{"type":20,"tag":194,"props":11453,"children":11454},{"style":264},[11455],{"type":30,"value":9724},{"type":20,"tag":194,"props":11457,"children":11458},{"class":196,"line":3934},[11459],{"type":20,"tag":194,"props":11460,"children":11461},{"emptyLinePlaceholder":546},[11462],{"type":30,"value":549},{"type":20,"tag":194,"props":11464,"children":11465},{"class":196,"line":3943},[11466,11470,11474,11478],{"type":20,"tag":194,"props":11467,"children":11468},{"style":252},[11469],{"type":30,"value":1943},{"type":20,"tag":194,"props":11471,"children":11472},{"style":264},[11473],{"type":30,"value":10479},{"type":20,"tag":194,"props":11475,"children":11476},{"style":258},[11477],{"type":30,"value":10027},{"type":20,"tag":194,"props":11479,"children":11480},{"style":264},[11481],{"type":30,"value":539},{"type":20,"tag":194,"props":11483,"children":11485},{"class":196,"line":11484},162,[11486],{"type":20,"tag":194,"props":11487,"children":11488},{"style":264},[11489],{"type":30,"value":10731},{"type":20,"tag":194,"props":11491,"children":11493},{"class":196,"line":11492},163,[11494],{"type":20,"tag":194,"props":11495,"children":11496},{"style":201},[11497],{"type":30,"value":6297},{"type":20,"tag":194,"props":11499,"children":11501},{"class":196,"line":11500},164,[11502],{"type":20,"tag":194,"props":11503,"children":11504},{"style":201},[11505],{"type":30,"value":11506},"         * Delete the jalic database and recreate it.\n",{"type":20,"tag":194,"props":11508,"children":11510},{"class":196,"line":11509},165,[11511,11515,11519,11523],{"type":20,"tag":194,"props":11512,"children":11513},{"style":201},[11514],{"type":30,"value":9451},{"type":20,"tag":194,"props":11516,"children":11517},{"style":252},[11518],{"type":30,"value":964},{"type":20,"tag":194,"props":11520,"children":11521},{"style":258},[11522],{"type":30,"value":10221},{"type":20,"tag":194,"props":11524,"children":11525},{"style":201},[11526],{"type":30,"value":10226},{"type":20,"tag":194,"props":11528,"children":11530},{"class":196,"line":11529},166,[11531],{"type":20,"tag":194,"props":11532,"children":11533},{"style":201},[11534],{"type":30,"value":10234},{"type":20,"tag":194,"props":11536,"children":11538},{"class":196,"line":11537},167,[11539],{"type":20,"tag":194,"props":11540,"children":11541},{"style":201},[11542],{"type":30,"value":6313},{"type":20,"tag":194,"props":11544,"children":11546},{"class":196,"line":11545},168,[11547,11552,11556,11560],{"type":20,"tag":194,"props":11548,"children":11549},{"style":258},[11550],{"type":30,"value":11551},"        clear",{"type":20,"tag":194,"props":11553,"children":11554},{"style":264},[11555],{"type":30,"value":1554},{"type":20,"tag":194,"props":11557,"children":11558},{"style":252},[11559],{"type":30,"value":393},{"type":20,"tag":194,"props":11561,"children":11562},{"style":264},[11563],{"type":30,"value":4121},{"type":20,"tag":194,"props":11565,"children":11567},{"class":196,"line":11566},169,[11568,11572,11576,11580,11584,11588],{"type":20,"tag":194,"props":11569,"children":11570},{"style":252},[11571],{"type":30,"value":7360},{"type":20,"tag":194,"props":11573,"children":11574},{"style":264},[11575],{"type":30,"value":10298},{"type":20,"tag":194,"props":11577,"children":11578},{"style":252},[11579],{"type":30,"value":461},{"type":20,"tag":194,"props":11581,"children":11582},{"style":264},[11583],{"type":30,"value":9118},{"type":20,"tag":194,"props":11585,"children":11586},{"style":258},[11587],{"type":30,"value":9123},{"type":20,"tag":194,"props":11589,"children":11590},{"style":264},[11591],{"type":30,"value":476},{"type":20,"tag":194,"props":11593,"children":11595},{"class":196,"line":11594},170,[11596,11600,11604,11608,11613,11617,11621],{"type":20,"tag":194,"props":11597,"children":11598},{"style":264},[11599],{"type":30,"value":10930},{"type":20,"tag":194,"props":11601,"children":11602},{"style":252},[11603],{"type":30,"value":461},{"type":20,"tag":194,"props":11605,"children":11606},{"style":264},[11607],{"type":30,"value":9379},{"type":20,"tag":194,"props":11609,"children":11610},{"style":258},[11611],{"type":30,"value":11612},"deleteDatabase",{"type":20,"tag":194,"props":11614,"children":11615},{"style":264},[11616],{"type":30,"value":403},{"type":20,"tag":194,"props":11618,"children":11619},{"style":506},[11620],{"type":30,"value":9392},{"type":20,"tag":194,"props":11622,"children":11623},{"style":264},[11624],{"type":30,"value":1649},{"type":20,"tag":194,"props":11626,"children":11628},{"class":196,"line":11627},171,[11629],{"type":20,"tag":194,"props":11630,"children":11631},{"emptyLinePlaceholder":546},[11632],{"type":30,"value":549},{"type":20,"tag":194,"props":11634,"children":11636},{"class":196,"line":11635},172,[11637,11642,11646,11650,11654],{"type":20,"tag":194,"props":11638,"children":11639},{"style":264},[11640],{"type":30,"value":11641},"            dbReady ",{"type":20,"tag":194,"props":11643,"children":11644},{"style":252},[11645],{"type":30,"value":461},{"type":20,"tag":194,"props":11647,"children":11648},{"style":264},[11649],{"type":30,"value":9118},{"type":20,"tag":194,"props":11651,"children":11652},{"style":258},[11653],{"type":30,"value":9123},{"type":20,"tag":194,"props":11655,"children":11656},{"style":264},[11657],{"type":30,"value":539},{"type":20,"tag":194,"props":11659,"children":11661},{"class":196,"line":11660},173,[11662],{"type":20,"tag":194,"props":11663,"children":11664},{"emptyLinePlaceholder":546},[11665],{"type":30,"value":549},{"type":20,"tag":194,"props":11667,"children":11669},{"class":196,"line":11668},174,[11670,11674,11678,11682,11686,11690,11694],{"type":20,"tag":194,"props":11671,"children":11672},{"style":264},[11673],{"type":30,"value":10635},{"type":20,"tag":194,"props":11675,"children":11676},{"style":258},[11677],{"type":30,"value":9480},{"type":20,"tag":194,"props":11679,"children":11680},{"style":252},[11681],{"type":30,"value":3298},{"type":20,"tag":194,"props":11683,"children":11684},{"style":252},[11685],{"type":30,"value":3303},{"type":20,"tag":194,"props":11687,"children":11688},{"style":264},[11689],{"type":30,"value":403},{"type":20,"tag":194,"props":11691,"children":11692},{"style":406},[11693],{"type":30,"value":9497},{"type":20,"tag":194,"props":11695,"children":11696},{"style":264},[11697],{"type":30,"value":4253},{"type":20,"tag":194,"props":11699,"children":11701},{"class":196,"line":11700},175,[11702,11706,11710],{"type":20,"tag":194,"props":11703,"children":11704},{"style":264},[11705],{"type":30,"value":2742},{"type":20,"tag":194,"props":11707,"children":11708},{"style":258},[11709],{"type":30,"value":796},{"type":20,"tag":194,"props":11711,"children":11712},{"style":264},[11713],{"type":30,"value":9517},{"type":20,"tag":194,"props":11715,"children":11717},{"class":196,"line":11716},176,[11718,11722,11726],{"type":20,"tag":194,"props":11719,"children":11720},{"style":264},[11721],{"type":30,"value":10682},{"type":20,"tag":194,"props":11723,"children":11724},{"style":258},[11725],{"type":30,"value":1186},{"type":20,"tag":194,"props":11727,"children":11728},{"style":264},[11729],{"type":30,"value":9517},{"type":20,"tag":194,"props":11731,"children":11733},{"class":196,"line":11732},177,[11734],{"type":20,"tag":194,"props":11735,"children":11736},{"style":264},[11737],{"type":30,"value":9724},{"type":20,"tag":194,"props":11739,"children":11741},{"class":196,"line":11740},178,[11742],{"type":20,"tag":194,"props":11743,"children":11744},{"emptyLinePlaceholder":546},[11745],{"type":30,"value":549},{"type":20,"tag":194,"props":11747,"children":11749},{"class":196,"line":11748},179,[11750,11754,11758,11762,11766],{"type":20,"tag":194,"props":11751,"children":11752},{"style":264},[11753],{"type":30,"value":10635},{"type":20,"tag":194,"props":11755,"children":11756},{"style":258},[11757],{"type":30,"value":9946},{"type":20,"tag":194,"props":11759,"children":11760},{"style":252},[11761],{"type":30,"value":3298},{"type":20,"tag":194,"props":11763,"children":11764},{"style":252},[11765],{"type":30,"value":3303},{"type":20,"tag":194,"props":11767,"children":11768},{"style":264},[11769],{"type":30,"value":4121},{"type":20,"tag":194,"props":11771,"children":11773},{"class":196,"line":11772},180,[11774,11778,11782,11786,11790],{"type":20,"tag":194,"props":11775,"children":11776},{"style":264},[11777],{"type":30,"value":9868},{"type":20,"tag":194,"props":11779,"children":11780},{"style":258},[11781],{"type":30,"value":4496},{"type":20,"tag":194,"props":11783,"children":11784},{"style":264},[11785],{"type":30,"value":403},{"type":20,"tag":194,"props":11787,"children":11788},{"style":252},[11789],{"type":30,"value":393},{"type":20,"tag":194,"props":11791,"children":11792},{"style":264},[11793],{"type":30,"value":4121},{"type":20,"tag":194,"props":11795,"children":11797},{"class":196,"line":11796},181,[11798,11803,11807],{"type":20,"tag":194,"props":11799,"children":11800},{"style":264},[11801],{"type":30,"value":11802},"                    defer.",{"type":20,"tag":194,"props":11804,"children":11805},{"style":258},[11806],{"type":30,"value":1177},{"type":20,"tag":194,"props":11808,"children":11809},{"style":264},[11810],{"type":30,"value":539},{"type":20,"tag":194,"props":11812,"children":11814},{"class":196,"line":11813},182,[11815],{"type":20,"tag":194,"props":11816,"children":11817},{"style":264},[11818],{"type":30,"value":11819},"                });\n",{"type":20,"tag":194,"props":11821,"children":11823},{"class":196,"line":11822},183,[11824],{"type":20,"tag":194,"props":11825,"children":11826},{"emptyLinePlaceholder":546},[11827],{"type":30,"value":549},{"type":20,"tag":194,"props":11829,"children":11831},{"class":196,"line":11830},184,[11832,11837],{"type":20,"tag":194,"props":11833,"children":11834},{"style":258},[11835],{"type":30,"value":11836},"                createDatabase",{"type":20,"tag":194,"props":11838,"children":11839},{"style":264},[11840],{"type":30,"value":10058},{"type":20,"tag":194,"props":11842,"children":11844},{"class":196,"line":11843},185,[11845],{"type":20,"tag":194,"props":11846,"children":11847},{"style":264},[11848],{"type":30,"value":9724},{"type":20,"tag":194,"props":11850,"children":11852},{"class":196,"line":11851},186,[11853],{"type":20,"tag":194,"props":11854,"children":11855},{"emptyLinePlaceholder":546},[11856],{"type":30,"value":549},{"type":20,"tag":194,"props":11858,"children":11860},{"class":196,"line":11859},187,[11861,11865,11869,11873],{"type":20,"tag":194,"props":11862,"children":11863},{"style":252},[11864],{"type":30,"value":1943},{"type":20,"tag":194,"props":11866,"children":11867},{"style":264},[11868],{"type":30,"value":10479},{"type":20,"tag":194,"props":11870,"children":11871},{"style":258},[11872],{"type":30,"value":10027},{"type":20,"tag":194,"props":11874,"children":11875},{"style":264},[11876],{"type":30,"value":539},{"type":20,"tag":194,"props":11878,"children":11880},{"class":196,"line":11879},188,[11881],{"type":20,"tag":194,"props":11882,"children":11883},{"style":264},[11884],{"type":30,"value":824},{"type":20,"tag":194,"props":11886,"children":11888},{"class":196,"line":11887},189,[11889],{"type":20,"tag":194,"props":11890,"children":11891},{"style":264},[11892],{"type":30,"value":3940},{"type":20,"tag":194,"props":11894,"children":11896},{"class":196,"line":11895},190,[11897],{"type":20,"tag":194,"props":11898,"children":11899},{"style":264},[11900],{"type":30,"value":11901},"})(jQuery, window);\n",{"type":20,"tag":21,"props":11903,"children":11904},{},[11905,11907],{"type":30,"value":11906},"The code and comments should give you a fair idea of what we're doing here - unlike the previously mentioned localForage or Dexie, we don't attempt to account for older, experimental versions of IndexedDB, or fallback to something like WebSQL. IndexedDB is the future! Maybe, probably, unless it also gets killed at some point. ",{"type":20,"tag":4379,"props":11908,"children":11909},{},[11910],{"type":30,"value":11911},"Knocks on wood",{"type":20,"tag":21,"props":11913,"children":11914},{},[11915],{"type":30,"value":11916},"We also aren't attempting to wrap everything IndexedDB can do - instead, we have a single database and objectStore into which we'll be shoving everything we intend to cache, and providing a simple wrapper around it that superficially resembles the Storage interface, with the exception that everything is asynchronous and returns a $.Deferred object.",{"type":20,"tag":21,"props":11918,"children":11919},{},[11920,11922,11929],{"type":30,"value":11921},"As a result of this setup, our actual caching logic can remain mostly the same - let's take a look and discuss what's changed (",{"type":20,"tag":25,"props":11923,"children":11926},{"href":11924,"rel":11925},"https://github.com/SaneMethod/jalic/blob/master/jquery-ajax-localstorage-indexeddb-cache.js",[50],[11927],{"type":30,"value":11928},"see the up-to-date code on Github",{"type":30,"value":11930},"):",{"type":20,"tag":184,"props":11932,"children":11934},{"className":186,"code":11933,"language":188,"meta":8,"style":8},"/**\n * https://github.com/SaneMethod/jalic\n */\n(function($, window){\n    /**\n     * Generate the cache key under which to store the local data - either the cache key supplied,\n     * or one generated from the url, the type and, if present, the data.\n     */\n    var genCacheKey = function (options) {\n        var url = options.url.replace(/jQuery.*/, '');\n\n        // Strip _={timestamp}, if cache is set to false\n        if (options.cache === false) {\n            url = url.replace(/([?&])_=[^&]*/, '');\n        }\n\n        return options.cacheKey || url + options.type + (options.data || '');\n    };\n\n    /**\n     * Determine whether we're using localStorage or, if the user has specified something other than a boolean\n     * value for options.localCache, whether the value appears to satisfy the plugin's requirements.\n     * Otherwise, throw a new TypeError indicating what type of value we expect.\n     * @param {boolean|object} storage\n     * @returns {boolean|object}\n     */\n    var getStorage = function(storage){\n        if (!storage) return false;\n        if (storage === true) return window.localStorage;\n        if (typeof storage === \"object\" && 'getItem' in storage &&\n            'removeItem' in storage && 'setItem' in storage)\n        {\n            return storage;\n        }\n        throw new TypeError(\"localCache must either be a boolean value, \" +\n            \"or an object which implements the Storage interface.\");\n    };\n\n    /**\n     * Remove the item specified by cacheKey from local storage (but not from the IndexedDB, as in all usages\n     * of this function we expect to overwrite the value with addToStorage shortly).\n     * @param {Storage|object} storage\n     * @param {string} cacheKey\n     */\n    var removeFromStorage = function(storage, cacheKey){\n        storage.removeItem(cacheKey);\n        storage.removeItem(cacheKey + 'cachettl');\n    };\n\n    /**\n     * Add an item to local storage and IndexedDB storage. We use local storage to satisfy our\n     * need to synchronously determine whether we have a value stored for a given key (and whether it is\n     * within the cachettl), and use IndexedDB to store the actual value associated with the key.\n     * @param {Storage|object} storage\n     * @param {string} cacheKey\n     * @param {number} ttl\n     * @param {*} data\n     * @param {string} dataType\n     * @returns {$.Deferred}\n     */\n    var addToStorage = function(storage, cacheKey, ttl, data, dataType){\n        var defer = $.Deferred();\n\n        try{\n            storage.setItem(cacheKey, 1);\n            storage.setItem(cacheKey + 'cachettl', ttl);\n        }catch(e){\n            removeFromStorage(storage, cacheKey);\n            defer.reject(e);\n\n            return defer.promise();\n        }\n\n        return $.jidb.setItem(cacheKey, data, dataType);\n    };\n\n    /**\n     * Prefilter for caching ajax calls.\n     * See also $.ajaxTransport for the elements that make this compatible with jQuery Deferred.\n     * New parameters available on the ajax call:\n     * localCache   : true              - required - either a boolean (in which case localStorage is used),\n     * or an object implementing the Storage interface, in which case that object is used instead.\n     * cacheTTL     : 5,                - optional - cache time in hours, default is 5.\n     * cacheKey     : 'myCacheKey',     - optional - key under which cached string will be stored\n     * isCacheValid : function          - optional - return true for valid, false for invalid\n     * @method $.ajaxPrefilter\n     * @param options {Object} Options for the ajax call, modified with ajax standard settings\n     */\n    $.ajaxPrefilter(function(options){\n        var storage = getStorage(options.localCache),\n            hourstl = +new Date() + 1000 * 60 * 60 * (options.cacheTTL || 5),\n            cacheKey = genCacheKey(options),\n            cacheValid = options.isCacheValid,\n            ttl,\n            value;\n\n        if (!storage) return;\n        ttl = storage.getItem(cacheKey + 'cachettl');\n\n        if (cacheValid && typeof cacheValid === 'function' && !cacheValid()){\n            removeFromStorage(storage, cacheKey);\n            ttl = 0;\n        }\n\n        if (ttl && ttl \u003C +new Date()){\n            removeFromStorage(storage, cacheKey);\n            ttl = 0;\n        }\n\n        value = storage.getItem(cacheKey);\n        if (!value){\n            // If it not in the cache, we store the data, add success callback - normal callback will proceed\n            if (options.success) {\n                options.realsuccess = options.success;\n            }\n            options.success = function(data, status, jqXHR) {\n                var dataType = this.dataType || jqXHR.getResponseHeader('Content-Type');\n\n                // Save the data to storage, catching Storage exception and IndexedDB exceptions alike\n                // and reject the returned promise as a result.\n                addToStorage(storage, cacheKey, hourstl, data, dataType).done(function(){\n                    if (options.realsuccess) options.realsuccess(data, status, jqXHR);\n                }).fail(function(event){\n                    console.log(event);\n                });\n            };\n        }\n    });\n\n    /**\n     * This function performs the fetch from cache portion of the functionality needed to cache ajax\n     * calls and still fulfill the jqXHR Deferred Promise interface.\n     * See also $.ajaxPrefilter\n     * @method $.ajaxTransport\n     * @params options {Object} Options for the ajax call, modified with ajax standard settings\n     */\n    $.ajaxTransport(\"+*\", function(options){\n        if (options.localCache)\n        {\n            var cacheKey = genCacheKey(options),\n                storage = getStorage(options.localCache),\n                value = (storage) ? storage.getItem(cacheKey) : false;\n\n            if (value){\n                /**\n                 * If the key is in the Storage-based cache, indicate that we want to handle this ajax request\n                 * (by returning a value), and use the cache key to retrieve the value from the IndexedDB. Then,\n                 * call the completeCallback with the fetched value.\n                 */\n                return {\n                    send:function(headers, completeCallback) {\n                        $.jidb.getItem(cacheKey).done(function(result){\n                            var response = {};\n                            response[result.dataType] = result.data;\n                            completeCallback(200, 'success', response, '');\n                        }).fail(function(){\n                            completeCallback(500, 'cache failure', void 0, '');\n                        });\n                    },\n                    abort:function() {\n                        console.log(\"Aborted ajax transport for caching.\");\n                    }\n                };\n            }\n        }\n    });\n})(jQuery, window);\n",[11935],{"type":20,"tag":68,"props":11936,"children":11937},{"__ignoreMap":8},[11938,11945,11953,11960,11991,11998,12005,12013,12020,12052,12117,12124,12132,12156,12234,12241,12248,12298,12305,12312,12319,12326,12333,12340,12359,12374,12381,12412,12443,12475,12522,12554,12561,12572,12579,12606,12617,12624,12631,12638,12646,12654,12673,12692,12699,12738,12753,12780,12787,12794,12801,12809,12817,12825,12844,12863,12884,12904,12923,12939,12946,13011,13038,13045,13057,13081,13109,13126,13137,13154,13161,13180,13187,13194,13215,13222,13229,13236,13244,13252,13260,13268,13276,13284,13292,13300,13317,13338,13345,13378,13402,13470,13490,13506,13513,13521,13528,13555,13590,13597,13645,13656,13675,13682,13689,13724,13735,13754,13761,13768,13791,13811,13819,13832,13849,13856,13905,13956,13963,13971,13979,14008,14031,14063,14079,14086,14093,14100,14107,14114,14121,14129,14137,14145,14161,14178,14185,14226,14238,14245,14269,14289,14335,14342,14354,14362,14370,14378,14386,14394,14405,14442,14484,14505,14522,14559,14583,14632,14640,14648,14669,14694,14702,14710,14717,14724,14731],{"type":20,"tag":194,"props":11939,"children":11940},{"class":196,"line":197},[11941],{"type":20,"tag":194,"props":11942,"children":11943},{"style":201},[11944],{"type":30,"value":1264},{"type":20,"tag":194,"props":11946,"children":11947},{"class":196,"line":207},[11948],{"type":20,"tag":194,"props":11949,"children":11950},{"style":201},[11951],{"type":30,"value":11952}," * https://github.com/SaneMethod/jalic\n",{"type":20,"tag":194,"props":11954,"children":11955},{"class":196,"line":216},[11956],{"type":20,"tag":194,"props":11957,"children":11958},{"style":201},[11959],{"type":30,"value":1312},{"type":20,"tag":194,"props":11961,"children":11962},{"class":196,"line":225},[11963,11967,11971,11975,11979,11983,11987],{"type":20,"tag":194,"props":11964,"children":11965},{"style":264},[11966],{"type":30,"value":403},{"type":20,"tag":194,"props":11968,"children":11969},{"style":252},[11970],{"type":30,"value":393},{"type":20,"tag":194,"props":11972,"children":11973},{"style":264},[11974],{"type":30,"value":403},{"type":20,"tag":194,"props":11976,"children":11977},{"style":406},[11978],{"type":30,"value":6468},{"type":20,"tag":194,"props":11980,"children":11981},{"style":264},[11982],{"type":30,"value":414},{"type":20,"tag":194,"props":11984,"children":11985},{"style":406},[11986],{"type":30,"value":9076},{"type":20,"tag":194,"props":11988,"children":11989},{"style":264},[11990],{"type":30,"value":4253},{"type":20,"tag":194,"props":11992,"children":11993},{"class":196,"line":234},[11994],{"type":20,"tag":194,"props":11995,"children":11996},{"style":201},[11997],{"type":30,"value":1399},{"type":20,"tag":194,"props":11999,"children":12000},{"class":196,"line":243},[12001],{"type":20,"tag":194,"props":12002,"children":12003},{"style":201},[12004],{"type":30,"value":1407},{"type":20,"tag":194,"props":12006,"children":12007},{"class":196,"line":275},[12008],{"type":20,"tag":194,"props":12009,"children":12010},{"style":201},[12011],{"type":30,"value":12012},"     * or one generated from the url, the type and, if present, the data.\n",{"type":20,"tag":194,"props":12014,"children":12015},{"class":196,"line":284},[12016],{"type":20,"tag":194,"props":12017,"children":12018},{"style":201},[12019],{"type":30,"value":1448},{"type":20,"tag":194,"props":12021,"children":12022},{"class":196,"line":311},[12023,12027,12031,12035,12039,12043,12048],{"type":20,"tag":194,"props":12024,"children":12025},{"style":252},[12026],{"type":30,"value":451},{"type":20,"tag":194,"props":12028,"children":12029},{"style":258},[12030],{"type":30,"value":1461},{"type":20,"tag":194,"props":12032,"children":12033},{"style":252},[12034],{"type":30,"value":3298},{"type":20,"tag":194,"props":12036,"children":12037},{"style":252},[12038],{"type":30,"value":3303},{"type":20,"tag":194,"props":12040,"children":12041},{"style":264},[12042],{"type":30,"value":1172},{"type":20,"tag":194,"props":12044,"children":12045},{"style":406},[12046],{"type":30,"value":12047},"options",{"type":20,"tag":194,"props":12049,"children":12050},{"style":264},[12051],{"type":30,"value":442},{"type":20,"tag":194,"props":12053,"children":12054},{"class":196,"line":320},[12055,12059,12063,12067,12072,12077,12081,12086,12091,12095,12100,12104,12108,12113],{"type":20,"tag":194,"props":12056,"children":12057},{"style":252},[12058],{"type":30,"value":1491},{"type":20,"tag":194,"props":12060,"children":12061},{"style":264},[12062],{"type":30,"value":1605},{"type":20,"tag":194,"props":12064,"children":12065},{"style":252},[12066],{"type":30,"value":461},{"type":20,"tag":194,"props":12068,"children":12069},{"style":264},[12070],{"type":30,"value":12071}," options.url.",{"type":20,"tag":194,"props":12073,"children":12074},{"style":258},[12075],{"type":30,"value":12076},"replace",{"type":20,"tag":194,"props":12078,"children":12079},{"style":264},[12080],{"type":30,"value":403},{"type":20,"tag":194,"props":12082,"children":12083},{"style":506},[12084],{"type":30,"value":12085},"/",{"type":20,"tag":194,"props":12087,"children":12089},{"style":12088},"--shiki-default:#032F62;--shiki-dark:#DBEDFF",[12090],{"type":30,"value":4412},{"type":20,"tag":194,"props":12092,"children":12093},{"style":680},[12094],{"type":30,"value":55},{"type":20,"tag":194,"props":12096,"children":12097},{"style":252},[12098],{"type":30,"value":12099},"*",{"type":20,"tag":194,"props":12101,"children":12102},{"style":506},[12103],{"type":30,"value":12085},{"type":20,"tag":194,"props":12105,"children":12106},{"style":264},[12107],{"type":30,"value":414},{"type":20,"tag":194,"props":12109,"children":12110},{"style":506},[12111],{"type":30,"value":12112},"''",{"type":20,"tag":194,"props":12114,"children":12115},{"style":264},[12116],{"type":30,"value":1649},{"type":20,"tag":194,"props":12118,"children":12119},{"class":196,"line":347},[12120],{"type":20,"tag":194,"props":12121,"children":12122},{"emptyLinePlaceholder":546},[12123],{"type":30,"value":549},{"type":20,"tag":194,"props":12125,"children":12126},{"class":196,"line":356},[12127],{"type":20,"tag":194,"props":12128,"children":12129},{"style":201},[12130],{"type":30,"value":12131},"        // Strip _={timestamp}, if cache is set to false\n",{"type":20,"tag":194,"props":12133,"children":12134},{"class":196,"line":378},[12135,12139,12144,12148,12152],{"type":20,"tag":194,"props":12136,"children":12137},{"style":252},[12138],{"type":30,"value":1782},{"type":20,"tag":194,"props":12140,"children":12141},{"style":264},[12142],{"type":30,"value":12143}," (options.cache ",{"type":20,"tag":194,"props":12145,"children":12146},{"style":252},[12147],{"type":30,"value":1826},{"type":20,"tag":194,"props":12149,"children":12150},{"style":680},[12151],{"type":30,"value":1804},{"type":20,"tag":194,"props":12153,"children":12154},{"style":264},[12155],{"type":30,"value":442},{"type":20,"tag":194,"props":12157,"children":12158},{"class":196,"line":387},[12159,12164,12168,12173,12177,12181,12185,12189,12194,12199,12204,12209,12214,12218,12222,12226,12230],{"type":20,"tag":194,"props":12160,"children":12161},{"style":264},[12162],{"type":30,"value":12163},"            url ",{"type":20,"tag":194,"props":12165,"children":12166},{"style":252},[12167],{"type":30,"value":461},{"type":20,"tag":194,"props":12169,"children":12170},{"style":264},[12171],{"type":30,"value":12172}," url.",{"type":20,"tag":194,"props":12174,"children":12175},{"style":258},[12176],{"type":30,"value":12076},{"type":20,"tag":194,"props":12178,"children":12179},{"style":264},[12180],{"type":30,"value":403},{"type":20,"tag":194,"props":12182,"children":12183},{"style":506},[12184],{"type":30,"value":12085},{"type":20,"tag":194,"props":12186,"children":12187},{"style":12088},[12188],{"type":30,"value":403},{"type":20,"tag":194,"props":12190,"children":12191},{"style":680},[12192],{"type":30,"value":12193},"[?&]",{"type":20,"tag":194,"props":12195,"children":12196},{"style":12088},[12197],{"type":30,"value":12198},")_=",{"type":20,"tag":194,"props":12200,"children":12201},{"style":680},[12202],{"type":30,"value":12203},"[",{"type":20,"tag":194,"props":12205,"children":12206},{"style":252},[12207],{"type":30,"value":12208},"^",{"type":20,"tag":194,"props":12210,"children":12211},{"style":680},[12212],{"type":30,"value":12213},"&]",{"type":20,"tag":194,"props":12215,"children":12216},{"style":252},[12217],{"type":30,"value":12099},{"type":20,"tag":194,"props":12219,"children":12220},{"style":506},[12221],{"type":30,"value":12085},{"type":20,"tag":194,"props":12223,"children":12224},{"style":264},[12225],{"type":30,"value":414},{"type":20,"tag":194,"props":12227,"children":12228},{"style":506},[12229],{"type":30,"value":12112},{"type":20,"tag":194,"props":12231,"children":12232},{"style":264},[12233],{"type":30,"value":1649},{"type":20,"tag":194,"props":12235,"children":12236},{"class":196,"line":445},[12237],{"type":20,"tag":194,"props":12238,"children":12239},{"style":264},[12240],{"type":30,"value":824},{"type":20,"tag":194,"props":12242,"children":12243},{"class":196,"line":479},[12244],{"type":20,"tag":194,"props":12245,"children":12246},{"emptyLinePlaceholder":546},[12247],{"type":30,"value":549},{"type":20,"tag":194,"props":12249,"children":12250},{"class":196,"line":542},[12251,12255,12260,12264,12268,12272,12277,12281,12286,12290,12294],{"type":20,"tag":194,"props":12252,"children":12253},{"style":252},[12254],{"type":30,"value":1591},{"type":20,"tag":194,"props":12256,"children":12257},{"style":264},[12258],{"type":30,"value":12259}," options.cacheKey ",{"type":20,"tag":194,"props":12261,"children":12262},{"style":252},[12263],{"type":30,"value":519},{"type":20,"tag":194,"props":12265,"children":12266},{"style":264},[12267],{"type":30,"value":1605},{"type":20,"tag":194,"props":12269,"children":12270},{"style":252},[12271],{"type":30,"value":649},{"type":20,"tag":194,"props":12273,"children":12274},{"style":264},[12275],{"type":30,"value":12276}," options.type ",{"type":20,"tag":194,"props":12278,"children":12279},{"style":252},[12280],{"type":30,"value":649},{"type":20,"tag":194,"props":12282,"children":12283},{"style":264},[12284],{"type":30,"value":12285}," (options.data ",{"type":20,"tag":194,"props":12287,"children":12288},{"style":252},[12289],{"type":30,"value":519},{"type":20,"tag":194,"props":12291,"children":12292},{"style":506},[12293],{"type":30,"value":1623},{"type":20,"tag":194,"props":12295,"children":12296},{"style":264},[12297],{"type":30,"value":1649},{"type":20,"tag":194,"props":12299,"children":12300},{"class":196,"line":552},[12301],{"type":20,"tag":194,"props":12302,"children":12303},{"style":264},[12304],{"type":30,"value":3940},{"type":20,"tag":194,"props":12306,"children":12307},{"class":196,"line":598},[12308],{"type":20,"tag":194,"props":12309,"children":12310},{"emptyLinePlaceholder":546},[12311],{"type":30,"value":549},{"type":20,"tag":194,"props":12313,"children":12314},{"class":196,"line":611},[12315],{"type":20,"tag":194,"props":12316,"children":12317},{"style":201},[12318],{"type":30,"value":1399},{"type":20,"tag":194,"props":12320,"children":12321},{"class":196,"line":630},[12322],{"type":20,"tag":194,"props":12323,"children":12324},{"style":201},[12325],{"type":30,"value":1679},{"type":20,"tag":194,"props":12327,"children":12328},{"class":196,"line":713},[12329],{"type":20,"tag":194,"props":12330,"children":12331},{"style":201},[12332],{"type":30,"value":1687},{"type":20,"tag":194,"props":12334,"children":12335},{"class":196,"line":743},[12336],{"type":20,"tag":194,"props":12337,"children":12338},{"style":201},[12339],{"type":30,"value":1695},{"type":20,"tag":194,"props":12341,"children":12342},{"class":196,"line":762},[12343,12347,12351,12355],{"type":20,"tag":194,"props":12344,"children":12345},{"style":201},[12346],{"type":30,"value":1431},{"type":20,"tag":194,"props":12348,"children":12349},{"style":252},[12350],{"type":30,"value":255},{"type":20,"tag":194,"props":12352,"children":12353},{"style":258},[12354],{"type":30,"value":1718},{"type":20,"tag":194,"props":12356,"children":12357},{"style":264},[12358],{"type":30,"value":1723},{"type":20,"tag":194,"props":12360,"children":12361},{"class":196,"line":771},[12362,12366,12370],{"type":20,"tag":194,"props":12363,"children":12364},{"style":201},[12365],{"type":30,"value":1431},{"type":20,"tag":194,"props":12367,"children":12368},{"style":252},[12369],{"type":30,"value":964},{"type":20,"tag":194,"props":12371,"children":12372},{"style":258},[12373],{"type":30,"value":1740},{"type":20,"tag":194,"props":12375,"children":12376},{"class":196,"line":785},[12377],{"type":20,"tag":194,"props":12378,"children":12379},{"style":201},[12380],{"type":30,"value":1448},{"type":20,"tag":194,"props":12382,"children":12383},{"class":196,"line":818},[12384,12388,12392,12396,12400,12404,12408],{"type":20,"tag":194,"props":12385,"children":12386},{"style":252},[12387],{"type":30,"value":451},{"type":20,"tag":194,"props":12389,"children":12390},{"style":258},[12391],{"type":30,"value":1761},{"type":20,"tag":194,"props":12393,"children":12394},{"style":252},[12395],{"type":30,"value":3298},{"type":20,"tag":194,"props":12397,"children":12398},{"style":252},[12399],{"type":30,"value":3303},{"type":20,"tag":194,"props":12401,"children":12402},{"style":264},[12403],{"type":30,"value":403},{"type":20,"tag":194,"props":12405,"children":12406},{"style":406},[12407],{"type":30,"value":419},{"type":20,"tag":194,"props":12409,"children":12410},{"style":264},[12411],{"type":30,"value":4253},{"type":20,"tag":194,"props":12413,"children":12414},{"class":196,"line":827},[12415,12419,12423,12427,12431,12435,12439],{"type":20,"tag":194,"props":12416,"children":12417},{"style":252},[12418],{"type":30,"value":1782},{"type":20,"tag":194,"props":12420,"children":12421},{"style":264},[12422],{"type":30,"value":1172},{"type":20,"tag":194,"props":12424,"children":12425},{"style":252},[12426],{"type":30,"value":1369},{"type":20,"tag":194,"props":12428,"children":12429},{"style":264},[12430],{"type":30,"value":1795},{"type":20,"tag":194,"props":12432,"children":12433},{"style":252},[12434],{"type":30,"value":1379},{"type":20,"tag":194,"props":12436,"children":12437},{"style":680},[12438],{"type":30,"value":1804},{"type":20,"tag":194,"props":12440,"children":12441},{"style":264},[12442],{"type":30,"value":1384},{"type":20,"tag":194,"props":12444,"children":12445},{"class":196,"line":836},[12446,12450,12454,12458,12462,12466,12470],{"type":20,"tag":194,"props":12447,"children":12448},{"style":252},[12449],{"type":30,"value":1782},{"type":20,"tag":194,"props":12451,"children":12452},{"style":264},[12453],{"type":30,"value":1821},{"type":20,"tag":194,"props":12455,"children":12456},{"style":252},[12457],{"type":30,"value":1826},{"type":20,"tag":194,"props":12459,"children":12460},{"style":680},[12461],{"type":30,"value":1831},{"type":20,"tag":194,"props":12463,"children":12464},{"style":264},[12465],{"type":30,"value":514},{"type":20,"tag":194,"props":12467,"children":12468},{"style":252},[12469],{"type":30,"value":1379},{"type":20,"tag":194,"props":12471,"children":12472},{"style":264},[12473],{"type":30,"value":12474}," window.localStorage;\n",{"type":20,"tag":194,"props":12476,"children":12477},{"class":196,"line":844},[12478,12482,12486,12490,12494,12498,12502,12506,12510,12514,12518],{"type":20,"tag":194,"props":12479,"children":12480},{"style":252},[12481],{"type":30,"value":1782},{"type":20,"tag":194,"props":12483,"children":12484},{"style":264},[12485],{"type":30,"value":1172},{"type":20,"tag":194,"props":12487,"children":12488},{"style":252},[12489],{"type":30,"value":1861},{"type":20,"tag":194,"props":12491,"children":12492},{"style":264},[12493],{"type":30,"value":1866},{"type":20,"tag":194,"props":12495,"children":12496},{"style":252},[12497],{"type":30,"value":1826},{"type":20,"tag":194,"props":12499,"children":12500},{"style":506},[12501],{"type":30,"value":1875},{"type":20,"tag":194,"props":12503,"children":12504},{"style":252},[12505],{"type":30,"value":1880},{"type":20,"tag":194,"props":12507,"children":12508},{"style":506},[12509],{"type":30,"value":1885},{"type":20,"tag":194,"props":12511,"children":12512},{"style":252},[12513],{"type":30,"value":1534},{"type":20,"tag":194,"props":12515,"children":12516},{"style":264},[12517],{"type":30,"value":1866},{"type":20,"tag":194,"props":12519,"children":12520},{"style":252},[12521],{"type":30,"value":1898},{"type":20,"tag":194,"props":12523,"children":12524},{"class":196,"line":858},[12525,12529,12533,12537,12541,12545,12549],{"type":20,"tag":194,"props":12526,"children":12527},{"style":506},[12528],{"type":30,"value":1907},{"type":20,"tag":194,"props":12530,"children":12531},{"style":252},[12532],{"type":30,"value":1534},{"type":20,"tag":194,"props":12534,"children":12535},{"style":264},[12536],{"type":30,"value":1866},{"type":20,"tag":194,"props":12538,"children":12539},{"style":252},[12540],{"type":30,"value":1920},{"type":20,"tag":194,"props":12542,"children":12543},{"style":506},[12544],{"type":30,"value":1925},{"type":20,"tag":194,"props":12546,"children":12547},{"style":252},[12548],{"type":30,"value":1534},{"type":20,"tag":194,"props":12550,"children":12551},{"style":264},[12552],{"type":30,"value":12553}," storage)\n",{"type":20,"tag":194,"props":12555,"children":12556},{"class":196,"line":1726},[12557],{"type":20,"tag":194,"props":12558,"children":12559},{"style":264},[12560],{"type":30,"value":1057},{"type":20,"tag":194,"props":12562,"children":12563},{"class":196,"line":1743},[12564,12568],{"type":20,"tag":194,"props":12565,"children":12566},{"style":252},[12567],{"type":30,"value":1943},{"type":20,"tag":194,"props":12569,"children":12570},{"style":264},[12571],{"type":30,"value":1948},{"type":20,"tag":194,"props":12573,"children":12574},{"class":196,"line":1751},[12575],{"type":20,"tag":194,"props":12576,"children":12577},{"style":264},[12578],{"type":30,"value":824},{"type":20,"tag":194,"props":12580,"children":12581},{"class":196,"line":1776},[12582,12586,12590,12594,12598,12602],{"type":20,"tag":194,"props":12583,"children":12584},{"style":252},[12585],{"type":30,"value":1965},{"type":20,"tag":194,"props":12587,"children":12588},{"style":252},[12589],{"type":30,"value":1031},{"type":20,"tag":194,"props":12591,"children":12592},{"style":258},[12593],{"type":30,"value":1974},{"type":20,"tag":194,"props":12595,"children":12596},{"style":264},[12597],{"type":30,"value":403},{"type":20,"tag":194,"props":12599,"children":12600},{"style":506},[12601],{"type":30,"value":1983},{"type":20,"tag":194,"props":12603,"children":12604},{"style":252},[12605],{"type":30,"value":1988},{"type":20,"tag":194,"props":12607,"children":12608},{"class":196,"line":1811},[12609,12613],{"type":20,"tag":194,"props":12610,"children":12611},{"style":506},[12612],{"type":30,"value":1997},{"type":20,"tag":194,"props":12614,"children":12615},{"style":264},[12616],{"type":30,"value":1649},{"type":20,"tag":194,"props":12618,"children":12619},{"class":196,"line":1847},[12620],{"type":20,"tag":194,"props":12621,"children":12622},{"style":264},[12623],{"type":30,"value":3940},{"type":20,"tag":194,"props":12625,"children":12626},{"class":196,"line":1901},[12627],{"type":20,"tag":194,"props":12628,"children":12629},{"emptyLinePlaceholder":546},[12630],{"type":30,"value":549},{"type":20,"tag":194,"props":12632,"children":12633},{"class":196,"line":1937},[12634],{"type":20,"tag":194,"props":12635,"children":12636},{"style":201},[12637],{"type":30,"value":1399},{"type":20,"tag":194,"props":12639,"children":12640},{"class":196,"line":1951},[12641],{"type":20,"tag":194,"props":12642,"children":12643},{"style":201},[12644],{"type":30,"value":12645},"     * Remove the item specified by cacheKey from local storage (but not from the IndexedDB, as in all usages\n",{"type":20,"tag":194,"props":12647,"children":12648},{"class":196,"line":1959},[12649],{"type":20,"tag":194,"props":12650,"children":12651},{"style":201},[12652],{"type":30,"value":12653},"     * of this function we expect to overwrite the value with addToStorage shortly).\n",{"type":20,"tag":194,"props":12655,"children":12656},{"class":196,"line":1991},[12657,12661,12665,12669],{"type":20,"tag":194,"props":12658,"children":12659},{"style":201},[12660],{"type":30,"value":1431},{"type":20,"tag":194,"props":12662,"children":12663},{"style":252},[12664],{"type":30,"value":255},{"type":20,"tag":194,"props":12666,"children":12667},{"style":258},[12668],{"type":30,"value":2059},{"type":20,"tag":194,"props":12670,"children":12671},{"style":264},[12672],{"type":30,"value":1723},{"type":20,"tag":194,"props":12674,"children":12675},{"class":196,"line":2004},[12676,12680,12684,12688],{"type":20,"tag":194,"props":12677,"children":12678},{"style":201},[12679],{"type":30,"value":1431},{"type":20,"tag":194,"props":12681,"children":12682},{"style":252},[12683],{"type":30,"value":255},{"type":20,"tag":194,"props":12685,"children":12686},{"style":258},[12687],{"type":30,"value":261},{"type":20,"tag":194,"props":12689,"children":12690},{"style":264},[12691],{"type":30,"value":2084},{"type":20,"tag":194,"props":12693,"children":12694},{"class":196,"line":2012},[12695],{"type":20,"tag":194,"props":12696,"children":12697},{"style":201},[12698],{"type":30,"value":1448},{"type":20,"tag":194,"props":12700,"children":12701},{"class":196,"line":2020},[12702,12706,12710,12714,12718,12722,12726,12730,12734],{"type":20,"tag":194,"props":12703,"children":12704},{"style":252},[12705],{"type":30,"value":451},{"type":20,"tag":194,"props":12707,"children":12708},{"style":258},[12709],{"type":30,"value":2105},{"type":20,"tag":194,"props":12711,"children":12712},{"style":252},[12713],{"type":30,"value":3298},{"type":20,"tag":194,"props":12715,"children":12716},{"style":252},[12717],{"type":30,"value":3303},{"type":20,"tag":194,"props":12719,"children":12720},{"style":264},[12721],{"type":30,"value":403},{"type":20,"tag":194,"props":12723,"children":12724},{"style":406},[12725],{"type":30,"value":419},{"type":20,"tag":194,"props":12727,"children":12728},{"style":264},[12729],{"type":30,"value":414},{"type":20,"tag":194,"props":12731,"children":12732},{"style":406},[12733],{"type":30,"value":409},{"type":20,"tag":194,"props":12735,"children":12736},{"style":264},[12737],{"type":30,"value":4253},{"type":20,"tag":194,"props":12739,"children":12740},{"class":196,"line":2028},[12741,12745,12749],{"type":20,"tag":194,"props":12742,"children":12743},{"style":264},[12744],{"type":30,"value":2134},{"type":20,"tag":194,"props":12746,"children":12747},{"style":258},[12748],{"type":30,"value":2139},{"type":20,"tag":194,"props":12750,"children":12751},{"style":264},[12752],{"type":30,"value":2144},{"type":20,"tag":194,"props":12754,"children":12755},{"class":196,"line":2037},[12756,12760,12764,12768,12772,12776],{"type":20,"tag":194,"props":12757,"children":12758},{"style":264},[12759],{"type":30,"value":2134},{"type":20,"tag":194,"props":12761,"children":12762},{"style":258},[12763],{"type":30,"value":2139},{"type":20,"tag":194,"props":12765,"children":12766},{"style":264},[12767],{"type":30,"value":644},{"type":20,"tag":194,"props":12769,"children":12770},{"style":252},[12771],{"type":30,"value":649},{"type":20,"tag":194,"props":12773,"children":12774},{"style":506},[12775],{"type":30,"value":654},{"type":20,"tag":194,"props":12777,"children":12778},{"style":264},[12779],{"type":30,"value":1649},{"type":20,"tag":194,"props":12781,"children":12782},{"class":196,"line":2045},[12783],{"type":20,"tag":194,"props":12784,"children":12785},{"style":264},[12786],{"type":30,"value":3940},{"type":20,"tag":194,"props":12788,"children":12789},{"class":196,"line":2066},[12790],{"type":20,"tag":194,"props":12791,"children":12792},{"emptyLinePlaceholder":546},[12793],{"type":30,"value":549},{"type":20,"tag":194,"props":12795,"children":12796},{"class":196,"line":2087},[12797],{"type":20,"tag":194,"props":12798,"children":12799},{"style":201},[12800],{"type":30,"value":1399},{"type":20,"tag":194,"props":12802,"children":12803},{"class":196,"line":2095},[12804],{"type":20,"tag":194,"props":12805,"children":12806},{"style":201},[12807],{"type":30,"value":12808},"     * Add an item to local storage and IndexedDB storage. We use local storage to satisfy our\n",{"type":20,"tag":194,"props":12810,"children":12811},{"class":196,"line":2128},[12812],{"type":20,"tag":194,"props":12813,"children":12814},{"style":201},[12815],{"type":30,"value":12816},"     * need to synchronously determine whether we have a value stored for a given key (and whether it is\n",{"type":20,"tag":194,"props":12818,"children":12819},{"class":196,"line":2147},[12820],{"type":20,"tag":194,"props":12821,"children":12822},{"style":201},[12823],{"type":30,"value":12824},"     * within the cachettl), and use IndexedDB to store the actual value associated with the key.\n",{"type":20,"tag":194,"props":12826,"children":12827},{"class":196,"line":2175},[12828,12832,12836,12840],{"type":20,"tag":194,"props":12829,"children":12830},{"style":201},[12831],{"type":30,"value":1431},{"type":20,"tag":194,"props":12833,"children":12834},{"style":252},[12835],{"type":30,"value":255},{"type":20,"tag":194,"props":12837,"children":12838},{"style":258},[12839],{"type":30,"value":2059},{"type":20,"tag":194,"props":12841,"children":12842},{"style":264},[12843],{"type":30,"value":1723},{"type":20,"tag":194,"props":12845,"children":12846},{"class":196,"line":2203},[12847,12851,12855,12859],{"type":20,"tag":194,"props":12848,"children":12849},{"style":201},[12850],{"type":30,"value":1431},{"type":20,"tag":194,"props":12852,"children":12853},{"style":252},[12854],{"type":30,"value":255},{"type":20,"tag":194,"props":12856,"children":12857},{"style":258},[12858],{"type":30,"value":261},{"type":20,"tag":194,"props":12860,"children":12861},{"style":264},[12862],{"type":30,"value":2084},{"type":20,"tag":194,"props":12864,"children":12865},{"class":196,"line":2211},[12866,12870,12874,12879],{"type":20,"tag":194,"props":12867,"children":12868},{"style":201},[12869],{"type":30,"value":1431},{"type":20,"tag":194,"props":12871,"children":12872},{"style":252},[12873],{"type":30,"value":255},{"type":20,"tag":194,"props":12875,"children":12876},{"style":258},[12877],{"type":30,"value":12878}," {number}",{"type":20,"tag":194,"props":12880,"children":12881},{"style":264},[12882],{"type":30,"value":12883}," ttl\n",{"type":20,"tag":194,"props":12885,"children":12886},{"class":196,"line":2219},[12887,12891,12895,12900],{"type":20,"tag":194,"props":12888,"children":12889},{"style":201},[12890],{"type":30,"value":1431},{"type":20,"tag":194,"props":12892,"children":12893},{"style":252},[12894],{"type":30,"value":255},{"type":20,"tag":194,"props":12896,"children":12897},{"style":258},[12898],{"type":30,"value":12899}," {*}",{"type":20,"tag":194,"props":12901,"children":12902},{"style":264},[12903],{"type":30,"value":10190},{"type":20,"tag":194,"props":12905,"children":12906},{"class":196,"line":2227},[12907,12911,12915,12919],{"type":20,"tag":194,"props":12908,"children":12909},{"style":201},[12910],{"type":30,"value":1431},{"type":20,"tag":194,"props":12912,"children":12913},{"style":252},[12914],{"type":30,"value":255},{"type":20,"tag":194,"props":12916,"children":12917},{"style":258},[12918],{"type":30,"value":261},{"type":20,"tag":194,"props":12920,"children":12921},{"style":264},[12922],{"type":30,"value":952},{"type":20,"tag":194,"props":12924,"children":12925},{"class":196,"line":2236},[12926,12930,12934],{"type":20,"tag":194,"props":12927,"children":12928},{"style":201},[12929],{"type":30,"value":1431},{"type":20,"tag":194,"props":12931,"children":12932},{"style":252},[12933],{"type":30,"value":964},{"type":20,"tag":194,"props":12935,"children":12936},{"style":258},[12937],{"type":30,"value":12938}," {$.Deferred}\n",{"type":20,"tag":194,"props":12940,"children":12941},{"class":196,"line":2245},[12942],{"type":20,"tag":194,"props":12943,"children":12944},{"style":201},[12945],{"type":30,"value":1448},{"type":20,"tag":194,"props":12947,"children":12948},{"class":196,"line":2254},[12949,12953,12958,12962,12966,12970,12974,12978,12982,12986,12991,12995,12999,13003,13007],{"type":20,"tag":194,"props":12950,"children":12951},{"style":252},[12952],{"type":30,"value":451},{"type":20,"tag":194,"props":12954,"children":12955},{"style":258},[12956],{"type":30,"value":12957}," addToStorage",{"type":20,"tag":194,"props":12959,"children":12960},{"style":252},[12961],{"type":30,"value":3298},{"type":20,"tag":194,"props":12963,"children":12964},{"style":252},[12965],{"type":30,"value":3303},{"type":20,"tag":194,"props":12967,"children":12968},{"style":264},[12969],{"type":30,"value":403},{"type":20,"tag":194,"props":12971,"children":12972},{"style":406},[12973],{"type":30,"value":419},{"type":20,"tag":194,"props":12975,"children":12976},{"style":264},[12977],{"type":30,"value":414},{"type":20,"tag":194,"props":12979,"children":12980},{"style":406},[12981],{"type":30,"value":409},{"type":20,"tag":194,"props":12983,"children":12984},{"style":264},[12985],{"type":30,"value":414},{"type":20,"tag":194,"props":12987,"children":12988},{"style":406},[12989],{"type":30,"value":12990},"ttl",{"type":20,"tag":194,"props":12992,"children":12993},{"style":264},[12994],{"type":30,"value":414},{"type":20,"tag":194,"props":12996,"children":12997},{"style":406},[12998],{"type":30,"value":4513},{"type":20,"tag":194,"props":13000,"children":13001},{"style":264},[13002],{"type":30,"value":414},{"type":20,"tag":194,"props":13004,"children":13005},{"style":406},[13006],{"type":30,"value":1006},{"type":20,"tag":194,"props":13008,"children":13009},{"style":264},[13010],{"type":30,"value":4253},{"type":20,"tag":194,"props":13012,"children":13013},{"class":196,"line":2262},[13014,13018,13022,13026,13030,13034],{"type":20,"tag":194,"props":13015,"children":13016},{"style":252},[13017],{"type":30,"value":1491},{"type":20,"tag":194,"props":13019,"children":13020},{"style":264},[13021],{"type":30,"value":10298},{"type":20,"tag":194,"props":13023,"children":13024},{"style":252},[13025],{"type":30,"value":461},{"type":20,"tag":194,"props":13027,"children":13028},{"style":264},[13029],{"type":30,"value":9118},{"type":20,"tag":194,"props":13031,"children":13032},{"style":258},[13033],{"type":30,"value":9123},{"type":20,"tag":194,"props":13035,"children":13036},{"style":264},[13037],{"type":30,"value":539},{"type":20,"tag":194,"props":13039,"children":13040},{"class":196,"line":2286},[13041],{"type":20,"tag":194,"props":13042,"children":13043},{"emptyLinePlaceholder":546},[13044],{"type":30,"value":549},{"type":20,"tag":194,"props":13046,"children":13047},{"class":196,"line":2295},[13048,13052],{"type":20,"tag":194,"props":13049,"children":13050},{"style":252},[13051],{"type":30,"value":604},{"type":20,"tag":194,"props":13053,"children":13054},{"style":264},[13055],{"type":30,"value":13056},"{\n",{"type":20,"tag":194,"props":13058,"children":13059},{"class":196,"line":2319},[13060,13064,13068,13073,13077],{"type":20,"tag":194,"props":13061,"children":13062},{"style":264},[13063],{"type":30,"value":617},{"type":20,"tag":194,"props":13065,"children":13066},{"style":258},[13067],{"type":30,"value":622},{"type":20,"tag":194,"props":13069,"children":13070},{"style":264},[13071],{"type":30,"value":13072},"(cacheKey, ",{"type":20,"tag":194,"props":13074,"children":13075},{"style":680},[13076],{"type":30,"value":9401},{"type":20,"tag":194,"props":13078,"children":13079},{"style":264},[13080],{"type":30,"value":1649},{"type":20,"tag":194,"props":13082,"children":13083},{"class":196,"line":2328},[13084,13088,13092,13096,13100,13104],{"type":20,"tag":194,"props":13085,"children":13086},{"style":264},[13087],{"type":30,"value":617},{"type":20,"tag":194,"props":13089,"children":13090},{"style":258},[13091],{"type":30,"value":622},{"type":20,"tag":194,"props":13093,"children":13094},{"style":264},[13095],{"type":30,"value":644},{"type":20,"tag":194,"props":13097,"children":13098},{"style":252},[13099],{"type":30,"value":649},{"type":20,"tag":194,"props":13101,"children":13102},{"style":506},[13103],{"type":30,"value":654},{"type":20,"tag":194,"props":13105,"children":13106},{"style":264},[13107],{"type":30,"value":13108},", ttl);\n",{"type":20,"tag":194,"props":13110,"children":13111},{"class":196,"line":2352},[13112,13117,13121],{"type":20,"tag":194,"props":13113,"children":13114},{"style":264},[13115],{"type":30,"value":13116},"        }",{"type":20,"tag":194,"props":13118,"children":13119},{"style":252},[13120],{"type":30,"value":754},{"type":20,"tag":194,"props":13122,"children":13123},{"style":264},[13124],{"type":30,"value":13125},"(e){\n",{"type":20,"tag":194,"props":13127,"children":13128},{"class":196,"line":2361},[13129,13133],{"type":20,"tag":194,"props":13130,"children":13131},{"style":258},[13132],{"type":30,"value":777},{"type":20,"tag":194,"props":13134,"children":13135},{"style":264},[13136],{"type":30,"value":782},{"type":20,"tag":194,"props":13138,"children":13139},{"class":196,"line":2381},[13140,13145,13149],{"type":20,"tag":194,"props":13141,"children":13142},{"style":264},[13143],{"type":30,"value":13144},"            defer.",{"type":20,"tag":194,"props":13146,"children":13147},{"style":258},[13148],{"type":30,"value":1186},{"type":20,"tag":194,"props":13150,"children":13151},{"style":264},[13152],{"type":30,"value":13153},"(e);\n",{"type":20,"tag":194,"props":13155,"children":13156},{"class":196,"line":2389},[13157],{"type":20,"tag":194,"props":13158,"children":13159},{"emptyLinePlaceholder":546},[13160],{"type":30,"value":549},{"type":20,"tag":194,"props":13162,"children":13163},{"class":196,"line":2437},[13164,13168,13172,13176],{"type":20,"tag":194,"props":13165,"children":13166},{"style":252},[13167],{"type":30,"value":1943},{"type":20,"tag":194,"props":13169,"children":13170},{"style":264},[13171],{"type":30,"value":10479},{"type":20,"tag":194,"props":13173,"children":13174},{"style":258},[13175],{"type":30,"value":10027},{"type":20,"tag":194,"props":13177,"children":13178},{"style":264},[13179],{"type":30,"value":539},{"type":20,"tag":194,"props":13181,"children":13182},{"class":196,"line":2465},[13183],{"type":20,"tag":194,"props":13184,"children":13185},{"style":264},[13186],{"type":30,"value":824},{"type":20,"tag":194,"props":13188,"children":13189},{"class":196,"line":2518},[13190],{"type":20,"tag":194,"props":13191,"children":13192},{"emptyLinePlaceholder":546},[13193],{"type":30,"value":549},{"type":20,"tag":194,"props":13195,"children":13196},{"class":196,"line":2526},[13197,13201,13206,13210],{"type":20,"tag":194,"props":13198,"children":13199},{"style":252},[13200],{"type":30,"value":1591},{"type":20,"tag":194,"props":13202,"children":13203},{"style":264},[13204],{"type":30,"value":13205}," $.jidb.",{"type":20,"tag":194,"props":13207,"children":13208},{"style":258},[13209],{"type":30,"value":622},{"type":20,"tag":194,"props":13211,"children":13212},{"style":264},[13213],{"type":30,"value":13214},"(cacheKey, data, dataType);\n",{"type":20,"tag":194,"props":13216,"children":13217},{"class":196,"line":2567},[13218],{"type":20,"tag":194,"props":13219,"children":13220},{"style":264},[13221],{"type":30,"value":3940},{"type":20,"tag":194,"props":13223,"children":13224},{"class":196,"line":2580},[13225],{"type":20,"tag":194,"props":13226,"children":13227},{"emptyLinePlaceholder":546},[13228],{"type":30,"value":549},{"type":20,"tag":194,"props":13230,"children":13231},{"class":196,"line":2597},[13232],{"type":20,"tag":194,"props":13233,"children":13234},{"style":201},[13235],{"type":30,"value":1399},{"type":20,"tag":194,"props":13237,"children":13238},{"class":196,"line":2669},[13239],{"type":20,"tag":194,"props":13240,"children":13241},{"style":201},[13242],{"type":30,"value":13243},"     * Prefilter for caching ajax calls.\n",{"type":20,"tag":194,"props":13245,"children":13246},{"class":196,"line":2697},[13247],{"type":20,"tag":194,"props":13248,"children":13249},{"style":201},[13250],{"type":30,"value":13251},"     * See also $.ajaxTransport for the elements that make this compatible with jQuery Deferred.\n",{"type":20,"tag":194,"props":13253,"children":13254},{"class":196,"line":2714},[13255],{"type":20,"tag":194,"props":13256,"children":13257},{"style":201},[13258],{"type":30,"value":13259},"     * New parameters available on the ajax call:\n",{"type":20,"tag":194,"props":13261,"children":13262},{"class":196,"line":2723},[13263],{"type":20,"tag":194,"props":13264,"children":13265},{"style":201},[13266],{"type":30,"value":13267},"     * localCache   : true              - required - either a boolean (in which case localStorage is used),\n",{"type":20,"tag":194,"props":13269,"children":13270},{"class":196,"line":2736},[13271],{"type":20,"tag":194,"props":13272,"children":13273},{"style":201},[13274],{"type":30,"value":13275},"     * or an object implementing the Storage interface, in which case that object is used instead.\n",{"type":20,"tag":194,"props":13277,"children":13278},{"class":196,"line":2765},[13279],{"type":20,"tag":194,"props":13280,"children":13281},{"style":201},[13282],{"type":30,"value":13283},"     * cacheTTL     : 5,                - optional - cache time in hours, default is 5.\n",{"type":20,"tag":194,"props":13285,"children":13286},{"class":196,"line":2773},[13287],{"type":20,"tag":194,"props":13288,"children":13289},{"style":201},[13290],{"type":30,"value":13291},"     * cacheKey     : 'myCacheKey',     - optional - key under which cached string will be stored\n",{"type":20,"tag":194,"props":13293,"children":13294},{"class":196,"line":2782},[13295],{"type":20,"tag":194,"props":13296,"children":13297},{"style":201},[13298],{"type":30,"value":13299},"     * isCacheValid : function          - optional - return true for valid, false for invalid\n",{"type":20,"tag":194,"props":13301,"children":13302},{"class":196,"line":2790},[13303,13307,13312],{"type":20,"tag":194,"props":13304,"children":13305},{"style":201},[13306],{"type":30,"value":1431},{"type":20,"tag":194,"props":13308,"children":13309},{"style":252},[13310],{"type":30,"value":13311},"@method",{"type":20,"tag":194,"props":13313,"children":13314},{"style":258},[13315],{"type":30,"value":13316}," $.ajaxPrefilter\n",{"type":20,"tag":194,"props":13318,"children":13319},{"class":196,"line":2802},[13320,13324,13328,13333],{"type":20,"tag":194,"props":13321,"children":13322},{"style":201},[13323],{"type":30,"value":1431},{"type":20,"tag":194,"props":13325,"children":13326},{"style":252},[13327],{"type":30,"value":255},{"type":20,"tag":194,"props":13329,"children":13330},{"style":264},[13331],{"type":30,"value":13332}," options",{"type":20,"tag":194,"props":13334,"children":13335},{"style":201},[13336],{"type":30,"value":13337}," {Object} Options for the ajax call, modified with ajax standard settings\n",{"type":20,"tag":194,"props":13339,"children":13340},{"class":196,"line":2810},[13341],{"type":20,"tag":194,"props":13342,"children":13343},{"style":201},[13344],{"type":30,"value":1448},{"type":20,"tag":194,"props":13346,"children":13347},{"class":196,"line":2818},[13348,13353,13358,13362,13366,13370,13374],{"type":20,"tag":194,"props":13349,"children":13350},{"style":264},[13351],{"type":30,"value":13352},"    $.",{"type":20,"tag":194,"props":13354,"children":13355},{"style":258},[13356],{"type":30,"value":13357},"ajaxPrefilter",{"type":20,"tag":194,"props":13359,"children":13360},{"style":264},[13361],{"type":30,"value":403},{"type":20,"tag":194,"props":13363,"children":13364},{"style":252},[13365],{"type":30,"value":393},{"type":20,"tag":194,"props":13367,"children":13368},{"style":264},[13369],{"type":30,"value":403},{"type":20,"tag":194,"props":13371,"children":13372},{"style":406},[13373],{"type":30,"value":12047},{"type":20,"tag":194,"props":13375,"children":13376},{"style":264},[13377],{"type":30,"value":4253},{"type":20,"tag":194,"props":13379,"children":13380},{"class":196,"line":2826},[13381,13385,13389,13393,13397],{"type":20,"tag":194,"props":13382,"children":13383},{"style":252},[13384],{"type":30,"value":1491},{"type":20,"tag":194,"props":13386,"children":13387},{"style":264},[13388],{"type":30,"value":1866},{"type":20,"tag":194,"props":13390,"children":13391},{"style":252},[13392],{"type":30,"value":461},{"type":20,"tag":194,"props":13394,"children":13395},{"style":258},[13396],{"type":30,"value":1761},{"type":20,"tag":194,"props":13398,"children":13399},{"style":264},[13400],{"type":30,"value":13401},"(options.localCache),\n",{"type":20,"tag":194,"props":13403,"children":13404},{"class":196,"line":2835},[13405,13409,13413,13417,13421,13425,13429,13433,13437,13441,13445,13449,13453,13458,13462,13466],{"type":20,"tag":194,"props":13406,"children":13407},{"style":264},[13408],{"type":30,"value":3357},{"type":20,"tag":194,"props":13410,"children":13411},{"style":252},[13412],{"type":30,"value":461},{"type":20,"tag":194,"props":13414,"children":13415},{"style":252},[13416],{"type":30,"value":3679},{"type":20,"tag":194,"props":13418,"children":13419},{"style":258},[13420],{"type":30,"value":668},{"type":20,"tag":194,"props":13422,"children":13423},{"style":264},[13424],{"type":30,"value":673},{"type":20,"tag":194,"props":13426,"children":13427},{"style":252},[13428],{"type":30,"value":649},{"type":20,"tag":194,"props":13430,"children":13431},{"style":680},[13432],{"type":30,"value":683},{"type":20,"tag":194,"props":13434,"children":13435},{"style":252},[13436],{"type":30,"value":688},{"type":20,"tag":194,"props":13438,"children":13439},{"style":680},[13440],{"type":30,"value":693},{"type":20,"tag":194,"props":13442,"children":13443},{"style":252},[13444],{"type":30,"value":688},{"type":20,"tag":194,"props":13446,"children":13447},{"style":680},[13448],{"type":30,"value":693},{"type":20,"tag":194,"props":13450,"children":13451},{"style":252},[13452],{"type":30,"value":688},{"type":20,"tag":194,"props":13454,"children":13455},{"style":264},[13456],{"type":30,"value":13457}," (options.cacheTTL ",{"type":20,"tag":194,"props":13459,"children":13460},{"style":252},[13461],{"type":30,"value":519},{"type":20,"tag":194,"props":13463,"children":13464},{"style":680},[13465],{"type":30,"value":3375},{"type":20,"tag":194,"props":13467,"children":13468},{"style":264},[13469],{"type":30,"value":5651},{"type":20,"tag":194,"props":13471,"children":13472},{"class":196,"line":2844},[13473,13477,13481,13485],{"type":20,"tag":194,"props":13474,"children":13475},{"style":264},[13476],{"type":30,"value":3388},{"type":20,"tag":194,"props":13478,"children":13479},{"style":252},[13480],{"type":30,"value":461},{"type":20,"tag":194,"props":13482,"children":13483},{"style":258},[13484],{"type":30,"value":1461},{"type":20,"tag":194,"props":13486,"children":13487},{"style":264},[13488],{"type":30,"value":13489},"(options),\n",{"type":20,"tag":194,"props":13491,"children":13492},{"class":196,"line":2852},[13493,13497,13501],{"type":20,"tag":194,"props":13494,"children":13495},{"style":264},[13496],{"type":30,"value":3410},{"type":20,"tag":194,"props":13498,"children":13499},{"style":252},[13500],{"type":30,"value":461},{"type":20,"tag":194,"props":13502,"children":13503},{"style":264},[13504],{"type":30,"value":13505}," options.isCacheValid,\n",{"type":20,"tag":194,"props":13507,"children":13508},{"class":196,"line":2868},[13509],{"type":20,"tag":194,"props":13510,"children":13511},{"style":264},[13512],{"type":30,"value":3428},{"type":20,"tag":194,"props":13514,"children":13515},{"class":196,"line":2884},[13516],{"type":20,"tag":194,"props":13517,"children":13518},{"style":264},[13519],{"type":30,"value":13520},"            value;\n",{"type":20,"tag":194,"props":13522,"children":13523},{"class":196,"line":2900},[13524],{"type":20,"tag":194,"props":13525,"children":13526},{"emptyLinePlaceholder":546},[13527],{"type":30,"value":549},{"type":20,"tag":194,"props":13529,"children":13530},{"class":196,"line":2908},[13531,13535,13539,13543,13547,13551],{"type":20,"tag":194,"props":13532,"children":13533},{"style":252},[13534],{"type":30,"value":1782},{"type":20,"tag":194,"props":13536,"children":13537},{"style":264},[13538],{"type":30,"value":1172},{"type":20,"tag":194,"props":13540,"children":13541},{"style":252},[13542],{"type":30,"value":1369},{"type":20,"tag":194,"props":13544,"children":13545},{"style":264},[13546],{"type":30,"value":1795},{"type":20,"tag":194,"props":13548,"children":13549},{"style":252},[13550],{"type":30,"value":1379},{"type":20,"tag":194,"props":13552,"children":13553},{"style":264},[13554],{"type":30,"value":1384},{"type":20,"tag":194,"props":13556,"children":13557},{"class":196,"line":2940},[13558,13562,13566,13570,13574,13578,13582,13586],{"type":20,"tag":194,"props":13559,"children":13560},{"style":264},[13561],{"type":30,"value":3504},{"type":20,"tag":194,"props":13563,"children":13564},{"style":252},[13565],{"type":30,"value":461},{"type":20,"tag":194,"props":13567,"children":13568},{"style":264},[13569],{"type":30,"value":3513},{"type":20,"tag":194,"props":13571,"children":13572},{"style":258},[13573],{"type":30,"value":3518},{"type":20,"tag":194,"props":13575,"children":13576},{"style":264},[13577],{"type":30,"value":644},{"type":20,"tag":194,"props":13579,"children":13580},{"style":252},[13581],{"type":30,"value":649},{"type":20,"tag":194,"props":13583,"children":13584},{"style":506},[13585],{"type":30,"value":654},{"type":20,"tag":194,"props":13587,"children":13588},{"style":264},[13589],{"type":30,"value":1649},{"type":20,"tag":194,"props":13591,"children":13592},{"class":196,"line":2968},[13593],{"type":20,"tag":194,"props":13594,"children":13595},{"emptyLinePlaceholder":546},[13596],{"type":30,"value":549},{"type":20,"tag":194,"props":13598,"children":13599},{"class":196,"line":2977},[13600,13604,13608,13612,13616,13620,13624,13628,13632,13636,13640],{"type":20,"tag":194,"props":13601,"children":13602},{"style":252},[13603],{"type":30,"value":1782},{"type":20,"tag":194,"props":13605,"children":13606},{"style":264},[13607],{"type":30,"value":3555},{"type":20,"tag":194,"props":13609,"children":13610},{"style":252},[13611],{"type":30,"value":1920},{"type":20,"tag":194,"props":13613,"children":13614},{"style":252},[13615],{"type":30,"value":3564},{"type":20,"tag":194,"props":13617,"children":13618},{"style":264},[13619],{"type":30,"value":3569},{"type":20,"tag":194,"props":13621,"children":13622},{"style":252},[13623],{"type":30,"value":1826},{"type":20,"tag":194,"props":13625,"children":13626},{"style":506},[13627],{"type":30,"value":3578},{"type":20,"tag":194,"props":13629,"children":13630},{"style":252},[13631],{"type":30,"value":1880},{"type":20,"tag":194,"props":13633,"children":13634},{"style":252},[13635],{"type":30,"value":3587},{"type":20,"tag":194,"props":13637,"children":13638},{"style":258},[13639],{"type":30,"value":3592},{"type":20,"tag":194,"props":13641,"children":13642},{"style":264},[13643],{"type":30,"value":13644},"()){\n",{"type":20,"tag":194,"props":13646,"children":13647},{"class":196,"line":2986},[13648,13652],{"type":20,"tag":194,"props":13649,"children":13650},{"style":258},[13651],{"type":30,"value":777},{"type":20,"tag":194,"props":13653,"children":13654},{"style":264},[13655],{"type":30,"value":782},{"type":20,"tag":194,"props":13657,"children":13658},{"class":196,"line":3003},[13659,13663,13667,13671],{"type":20,"tag":194,"props":13660,"children":13661},{"style":264},[13662],{"type":30,"value":3618},{"type":20,"tag":194,"props":13664,"children":13665},{"style":252},[13666],{"type":30,"value":461},{"type":20,"tag":194,"props":13668,"children":13669},{"style":680},[13670],{"type":30,"value":3627},{"type":20,"tag":194,"props":13672,"children":13673},{"style":264},[13674],{"type":30,"value":1384},{"type":20,"tag":194,"props":13676,"children":13677},{"class":196,"line":3020},[13678],{"type":20,"tag":194,"props":13679,"children":13680},{"style":264},[13681],{"type":30,"value":824},{"type":20,"tag":194,"props":13683,"children":13684},{"class":196,"line":3029},[13685],{"type":20,"tag":194,"props":13686,"children":13687},{"emptyLinePlaceholder":546},[13688],{"type":30,"value":549},{"type":20,"tag":194,"props":13690,"children":13691},{"class":196,"line":3042},[13692,13696,13700,13704,13708,13712,13716,13720],{"type":20,"tag":194,"props":13693,"children":13694},{"style":252},[13695],{"type":30,"value":1782},{"type":20,"tag":194,"props":13697,"children":13698},{"style":264},[13699],{"type":30,"value":3660},{"type":20,"tag":194,"props":13701,"children":13702},{"style":252},[13703],{"type":30,"value":1920},{"type":20,"tag":194,"props":13705,"children":13706},{"style":264},[13707],{"type":30,"value":3669},{"type":20,"tag":194,"props":13709,"children":13710},{"style":252},[13711],{"type":30,"value":3674},{"type":20,"tag":194,"props":13713,"children":13714},{"style":252},[13715],{"type":30,"value":3679},{"type":20,"tag":194,"props":13717,"children":13718},{"style":258},[13719],{"type":30,"value":668},{"type":20,"tag":194,"props":13721,"children":13722},{"style":264},[13723],{"type":30,"value":13644},{"type":20,"tag":194,"props":13725,"children":13726},{"class":196,"line":3051},[13727,13731],{"type":20,"tag":194,"props":13728,"children":13729},{"style":258},[13730],{"type":30,"value":777},{"type":20,"tag":194,"props":13732,"children":13733},{"style":264},[13734],{"type":30,"value":782},{"type":20,"tag":194,"props":13736,"children":13737},{"class":196,"line":3059},[13738,13742,13746,13750],{"type":20,"tag":194,"props":13739,"children":13740},{"style":264},[13741],{"type":30,"value":3618},{"type":20,"tag":194,"props":13743,"children":13744},{"style":252},[13745],{"type":30,"value":461},{"type":20,"tag":194,"props":13747,"children":13748},{"style":680},[13749],{"type":30,"value":3627},{"type":20,"tag":194,"props":13751,"children":13752},{"style":264},[13753],{"type":30,"value":1384},{"type":20,"tag":194,"props":13755,"children":13756},{"class":196,"line":3068},[13757],{"type":20,"tag":194,"props":13758,"children":13759},{"style":264},[13760],{"type":30,"value":824},{"type":20,"tag":194,"props":13762,"children":13763},{"class":196,"line":3076},[13764],{"type":20,"tag":194,"props":13765,"children":13766},{"emptyLinePlaceholder":546},[13767],{"type":30,"value":549},{"type":20,"tag":194,"props":13769,"children":13770},{"class":196,"line":3120},[13771,13775,13779,13783,13787],{"type":20,"tag":194,"props":13772,"children":13773},{"style":264},[13774],{"type":30,"value":3724},{"type":20,"tag":194,"props":13776,"children":13777},{"style":252},[13778],{"type":30,"value":461},{"type":20,"tag":194,"props":13780,"children":13781},{"style":264},[13782],{"type":30,"value":3513},{"type":20,"tag":194,"props":13784,"children":13785},{"style":258},[13786],{"type":30,"value":3518},{"type":20,"tag":194,"props":13788,"children":13789},{"style":264},[13790],{"type":30,"value":2144},{"type":20,"tag":194,"props":13792,"children":13793},{"class":196,"line":3133},[13794,13798,13802,13806],{"type":20,"tag":194,"props":13795,"children":13796},{"style":252},[13797],{"type":30,"value":1782},{"type":20,"tag":194,"props":13799,"children":13800},{"style":264},[13801],{"type":30,"value":1172},{"type":20,"tag":194,"props":13803,"children":13804},{"style":252},[13805],{"type":30,"value":1369},{"type":20,"tag":194,"props":13807,"children":13808},{"style":264},[13809],{"type":30,"value":13810},"value){\n",{"type":20,"tag":194,"props":13812,"children":13813},{"class":196,"line":3141},[13814],{"type":20,"tag":194,"props":13815,"children":13816},{"style":201},[13817],{"type":30,"value":13818},"            // If it not in the cache, we store the data, add success callback - normal callback will proceed\n",{"type":20,"tag":194,"props":13820,"children":13821},{"class":196,"line":3149},[13822,13827],{"type":20,"tag":194,"props":13823,"children":13824},{"style":252},[13825],{"type":30,"value":13826},"            if",{"type":20,"tag":194,"props":13828,"children":13829},{"style":264},[13830],{"type":30,"value":13831}," (options.success) {\n",{"type":20,"tag":194,"props":13833,"children":13834},{"class":196,"line":3157},[13835,13840,13844],{"type":20,"tag":194,"props":13836,"children":13837},{"style":264},[13838],{"type":30,"value":13839},"                options.realsuccess ",{"type":20,"tag":194,"props":13841,"children":13842},{"style":252},[13843],{"type":30,"value":461},{"type":20,"tag":194,"props":13845,"children":13846},{"style":264},[13847],{"type":30,"value":13848}," options.success;\n",{"type":20,"tag":194,"props":13850,"children":13851},{"class":196,"line":3165},[13852],{"type":20,"tag":194,"props":13853,"children":13854},{"style":264},[13855],{"type":30,"value":1121},{"type":20,"tag":194,"props":13857,"children":13858},{"class":196,"line":3174},[13859,13864,13869,13873,13877,13881,13885,13889,13893,13897,13901],{"type":20,"tag":194,"props":13860,"children":13861},{"style":264},[13862],{"type":30,"value":13863},"            options.",{"type":20,"tag":194,"props":13865,"children":13866},{"style":258},[13867],{"type":30,"value":13868},"success",{"type":20,"tag":194,"props":13870,"children":13871},{"style":252},[13872],{"type":30,"value":3298},{"type":20,"tag":194,"props":13874,"children":13875},{"style":252},[13876],{"type":30,"value":3303},{"type":20,"tag":194,"props":13878,"children":13879},{"style":264},[13880],{"type":30,"value":403},{"type":20,"tag":194,"props":13882,"children":13883},{"style":406},[13884],{"type":30,"value":4513},{"type":20,"tag":194,"props":13886,"children":13887},{"style":264},[13888],{"type":30,"value":414},{"type":20,"tag":194,"props":13890,"children":13891},{"style":406},[13892],{"type":30,"value":5934},{"type":20,"tag":194,"props":13894,"children":13895},{"style":264},[13896],{"type":30,"value":414},{"type":20,"tag":194,"props":13898,"children":13899},{"style":406},[13900],{"type":30,"value":4563},{"type":20,"tag":194,"props":13902,"children":13903},{"style":264},[13904],{"type":30,"value":442},{"type":20,"tag":194,"props":13906,"children":13907},{"class":196,"line":3183},[13908,13913,13917,13921,13925,13930,13934,13939,13944,13948,13952],{"type":20,"tag":194,"props":13909,"children":13910},{"style":252},[13911],{"type":30,"value":13912},"                var",{"type":20,"tag":194,"props":13914,"children":13915},{"style":264},[13916],{"type":30,"value":10422},{"type":20,"tag":194,"props":13918,"children":13919},{"style":252},[13920],{"type":30,"value":461},{"type":20,"tag":194,"props":13922,"children":13923},{"style":680},[13924],{"type":30,"value":4142},{"type":20,"tag":194,"props":13926,"children":13927},{"style":264},[13928],{"type":30,"value":13929},".dataType ",{"type":20,"tag":194,"props":13931,"children":13932},{"style":252},[13933],{"type":30,"value":519},{"type":20,"tag":194,"props":13935,"children":13936},{"style":264},[13937],{"type":30,"value":13938}," jqXHR.",{"type":20,"tag":194,"props":13940,"children":13941},{"style":258},[13942],{"type":30,"value":13943},"getResponseHeader",{"type":20,"tag":194,"props":13945,"children":13946},{"style":264},[13947],{"type":30,"value":403},{"type":20,"tag":194,"props":13949,"children":13950},{"style":506},[13951],{"type":30,"value":509},{"type":20,"tag":194,"props":13953,"children":13954},{"style":264},[13955],{"type":30,"value":1649},{"type":20,"tag":194,"props":13957,"children":13958},{"class":196,"line":3192},[13959],{"type":20,"tag":194,"props":13960,"children":13961},{"emptyLinePlaceholder":546},[13962],{"type":30,"value":549},{"type":20,"tag":194,"props":13964,"children":13965},{"class":196,"line":3206},[13966],{"type":20,"tag":194,"props":13967,"children":13968},{"style":201},[13969],{"type":30,"value":13970},"                // Save the data to storage, catching Storage exception and IndexedDB exceptions alike\n",{"type":20,"tag":194,"props":13972,"children":13973},{"class":196,"line":3215},[13974],{"type":20,"tag":194,"props":13975,"children":13976},{"style":201},[13977],{"type":30,"value":13978},"                // and reject the returned promise as a result.\n",{"type":20,"tag":194,"props":13980,"children":13981},{"class":196,"line":3224},[13982,13987,13992,13996,14000,14004],{"type":20,"tag":194,"props":13983,"children":13984},{"style":258},[13985],{"type":30,"value":13986},"                addToStorage",{"type":20,"tag":194,"props":13988,"children":13989},{"style":264},[13990],{"type":30,"value":13991},"(storage, cacheKey, hourstl, data, dataType).",{"type":20,"tag":194,"props":13993,"children":13994},{"style":258},[13995],{"type":30,"value":4496},{"type":20,"tag":194,"props":13997,"children":13998},{"style":264},[13999],{"type":30,"value":403},{"type":20,"tag":194,"props":14001,"children":14002},{"style":252},[14003],{"type":30,"value":393},{"type":20,"tag":194,"props":14005,"children":14006},{"style":264},[14007],{"type":30,"value":4121},{"type":20,"tag":194,"props":14009,"children":14010},{"class":196,"line":3238},[14011,14016,14021,14026],{"type":20,"tag":194,"props":14012,"children":14013},{"style":252},[14014],{"type":30,"value":14015},"                    if",{"type":20,"tag":194,"props":14017,"children":14018},{"style":264},[14019],{"type":30,"value":14020}," (options.realsuccess) options.",{"type":20,"tag":194,"props":14022,"children":14023},{"style":258},[14024],{"type":30,"value":14025},"realsuccess",{"type":20,"tag":194,"props":14027,"children":14028},{"style":264},[14029],{"type":30,"value":14030},"(data, status, jqXHR);\n",{"type":20,"tag":194,"props":14032,"children":14033},{"class":196,"line":3247},[14034,14039,14043,14047,14051,14055,14059],{"type":20,"tag":194,"props":14035,"children":14036},{"style":264},[14037],{"type":30,"value":14038},"                }).",{"type":20,"tag":194,"props":14040,"children":14041},{"style":258},[14042],{"type":30,"value":4546},{"type":20,"tag":194,"props":14044,"children":14045},{"style":264},[14046],{"type":30,"value":403},{"type":20,"tag":194,"props":14048,"children":14049},{"style":252},[14050],{"type":30,"value":393},{"type":20,"tag":194,"props":14052,"children":14053},{"style":264},[14054],{"type":30,"value":403},{"type":20,"tag":194,"props":14056,"children":14057},{"style":406},[14058],{"type":30,"value":9497},{"type":20,"tag":194,"props":14060,"children":14061},{"style":264},[14062],{"type":30,"value":4253},{"type":20,"tag":194,"props":14064,"children":14065},{"class":196,"line":3261},[14066,14071,14075],{"type":20,"tag":194,"props":14067,"children":14068},{"style":264},[14069],{"type":30,"value":14070},"                    console.",{"type":20,"tag":194,"props":14072,"children":14073},{"style":258},[14074],{"type":30,"value":796},{"type":20,"tag":194,"props":14076,"children":14077},{"style":264},[14078],{"type":30,"value":9517},{"type":20,"tag":194,"props":14080,"children":14081},{"class":196,"line":3275},[14082],{"type":20,"tag":194,"props":14083,"children":14084},{"style":264},[14085],{"type":30,"value":11819},{"type":20,"tag":194,"props":14087,"children":14088},{"class":196,"line":3283},[14089],{"type":20,"tag":194,"props":14090,"children":14091},{"style":264},[14092],{"type":30,"value":9724},{"type":20,"tag":194,"props":14094,"children":14095},{"class":196,"line":3326},[14096],{"type":20,"tag":194,"props":14097,"children":14098},{"style":264},[14099],{"type":30,"value":824},{"type":20,"tag":194,"props":14101,"children":14102},{"class":196,"line":3351},[14103],{"type":20,"tag":194,"props":14104,"children":14105},{"style":264},[14106],{"type":30,"value":833},{"type":20,"tag":194,"props":14108,"children":14109},{"class":196,"line":3382},[14110],{"type":20,"tag":194,"props":14111,"children":14112},{"emptyLinePlaceholder":546},[14113],{"type":30,"value":549},{"type":20,"tag":194,"props":14115,"children":14116},{"class":196,"line":3404},[14117],{"type":20,"tag":194,"props":14118,"children":14119},{"style":201},[14120],{"type":30,"value":1399},{"type":20,"tag":194,"props":14122,"children":14123},{"class":196,"line":3422},[14124],{"type":20,"tag":194,"props":14125,"children":14126},{"style":201},[14127],{"type":30,"value":14128},"     * This function performs the fetch from cache portion of the functionality needed to cache ajax\n",{"type":20,"tag":194,"props":14130,"children":14131},{"class":196,"line":3431},[14132],{"type":20,"tag":194,"props":14133,"children":14134},{"style":201},[14135],{"type":30,"value":14136},"     * calls and still fulfill the jqXHR Deferred Promise interface.\n",{"type":20,"tag":194,"props":14138,"children":14139},{"class":196,"line":3439},[14140],{"type":20,"tag":194,"props":14141,"children":14142},{"style":201},[14143],{"type":30,"value":14144},"     * See also $.ajaxPrefilter\n",{"type":20,"tag":194,"props":14146,"children":14147},{"class":196,"line":3448},[14148,14152,14156],{"type":20,"tag":194,"props":14149,"children":14150},{"style":201},[14151],{"type":30,"value":1431},{"type":20,"tag":194,"props":14153,"children":14154},{"style":252},[14155],{"type":30,"value":13311},{"type":20,"tag":194,"props":14157,"children":14158},{"style":258},[14159],{"type":30,"value":14160}," $.ajaxTransport\n",{"type":20,"tag":194,"props":14162,"children":14163},{"class":196,"line":3456},[14164,14168,14173],{"type":20,"tag":194,"props":14165,"children":14166},{"style":201},[14167],{"type":30,"value":1431},{"type":20,"tag":194,"props":14169,"children":14170},{"style":252},[14171],{"type":30,"value":14172},"@params",{"type":20,"tag":194,"props":14174,"children":14175},{"style":201},[14176],{"type":30,"value":14177}," options {Object} Options for the ajax call, modified with ajax standard settings\n",{"type":20,"tag":194,"props":14179,"children":14180},{"class":196,"line":3490},[14181],{"type":20,"tag":194,"props":14182,"children":14183},{"style":201},[14184],{"type":30,"value":1448},{"type":20,"tag":194,"props":14186,"children":14187},{"class":196,"line":3498},[14188,14192,14197,14201,14206,14210,14214,14218,14222],{"type":20,"tag":194,"props":14189,"children":14190},{"style":264},[14191],{"type":30,"value":13352},{"type":20,"tag":194,"props":14193,"children":14194},{"style":258},[14195],{"type":30,"value":14196},"ajaxTransport",{"type":20,"tag":194,"props":14198,"children":14199},{"style":264},[14200],{"type":30,"value":403},{"type":20,"tag":194,"props":14202,"children":14203},{"style":506},[14204],{"type":30,"value":14205},"\"+*\"",{"type":20,"tag":194,"props":14207,"children":14208},{"style":264},[14209],{"type":30,"value":414},{"type":20,"tag":194,"props":14211,"children":14212},{"style":252},[14213],{"type":30,"value":393},{"type":20,"tag":194,"props":14215,"children":14216},{"style":264},[14217],{"type":30,"value":403},{"type":20,"tag":194,"props":14219,"children":14220},{"style":406},[14221],{"type":30,"value":12047},{"type":20,"tag":194,"props":14223,"children":14224},{"style":264},[14225],{"type":30,"value":4253},{"type":20,"tag":194,"props":14227,"children":14228},{"class":196,"line":3537},[14229,14233],{"type":20,"tag":194,"props":14230,"children":14231},{"style":252},[14232],{"type":30,"value":1782},{"type":20,"tag":194,"props":14234,"children":14235},{"style":264},[14236],{"type":30,"value":14237}," (options.localCache)\n",{"type":20,"tag":194,"props":14239,"children":14240},{"class":196,"line":3545},[14241],{"type":20,"tag":194,"props":14242,"children":14243},{"style":264},[14244],{"type":30,"value":1057},{"type":20,"tag":194,"props":14246,"children":14247},{"class":196,"line":3600},[14248,14252,14257,14261,14265],{"type":20,"tag":194,"props":14249,"children":14250},{"style":252},[14251],{"type":30,"value":7360},{"type":20,"tag":194,"props":14253,"children":14254},{"style":264},[14255],{"type":30,"value":14256}," cacheKey ",{"type":20,"tag":194,"props":14258,"children":14259},{"style":252},[14260],{"type":30,"value":461},{"type":20,"tag":194,"props":14262,"children":14263},{"style":258},[14264],{"type":30,"value":1461},{"type":20,"tag":194,"props":14266,"children":14267},{"style":264},[14268],{"type":30,"value":13489},{"type":20,"tag":194,"props":14270,"children":14271},{"class":196,"line":3612},[14272,14277,14281,14285],{"type":20,"tag":194,"props":14273,"children":14274},{"style":264},[14275],{"type":30,"value":14276},"                storage ",{"type":20,"tag":194,"props":14278,"children":14279},{"style":252},[14280],{"type":30,"value":461},{"type":20,"tag":194,"props":14282,"children":14283},{"style":258},[14284],{"type":30,"value":1761},{"type":20,"tag":194,"props":14286,"children":14287},{"style":264},[14288],{"type":30,"value":13401},{"type":20,"tag":194,"props":14290,"children":14291},{"class":196,"line":3634},[14292,14297,14301,14306,14310,14314,14318,14323,14327,14331],{"type":20,"tag":194,"props":14293,"children":14294},{"style":264},[14295],{"type":30,"value":14296},"                value ",{"type":20,"tag":194,"props":14298,"children":14299},{"style":252},[14300],{"type":30,"value":461},{"type":20,"tag":194,"props":14302,"children":14303},{"style":264},[14304],{"type":30,"value":14305}," (storage) ",{"type":20,"tag":194,"props":14307,"children":14308},{"style":252},[14309],{"type":30,"value":1544},{"type":20,"tag":194,"props":14311,"children":14312},{"style":264},[14313],{"type":30,"value":3513},{"type":20,"tag":194,"props":14315,"children":14316},{"style":258},[14317],{"type":30,"value":3518},{"type":20,"tag":194,"props":14319,"children":14320},{"style":264},[14321],{"type":30,"value":14322},"(cacheKey) ",{"type":20,"tag":194,"props":14324,"children":14325},{"style":252},[14326],{"type":30,"value":1554},{"type":20,"tag":194,"props":14328,"children":14329},{"style":680},[14330],{"type":30,"value":1804},{"type":20,"tag":194,"props":14332,"children":14333},{"style":264},[14334],{"type":30,"value":1384},{"type":20,"tag":194,"props":14336,"children":14337},{"class":196,"line":3642},[14338],{"type":20,"tag":194,"props":14339,"children":14340},{"emptyLinePlaceholder":546},[14341],{"type":30,"value":549},{"type":20,"tag":194,"props":14343,"children":14344},{"class":196,"line":3650},[14345,14349],{"type":20,"tag":194,"props":14346,"children":14347},{"style":252},[14348],{"type":30,"value":13826},{"type":20,"tag":194,"props":14350,"children":14351},{"style":264},[14352],{"type":30,"value":14353}," (value){\n",{"type":20,"tag":194,"props":14355,"children":14356},{"class":196,"line":3690},[14357],{"type":20,"tag":194,"props":14358,"children":14359},{"style":201},[14360],{"type":30,"value":14361},"                /**\n",{"type":20,"tag":194,"props":14363,"children":14364},{"class":196,"line":3702},[14365],{"type":20,"tag":194,"props":14366,"children":14367},{"style":201},[14368],{"type":30,"value":14369},"                 * If the key is in the Storage-based cache, indicate that we want to handle this ajax request\n",{"type":20,"tag":194,"props":14371,"children":14372},{"class":196,"line":3710},[14373],{"type":20,"tag":194,"props":14374,"children":14375},{"style":201},[14376],{"type":30,"value":14377},"                 * (by returning a value), and use the cache key to retrieve the value from the IndexedDB. Then,\n",{"type":20,"tag":194,"props":14379,"children":14380},{"class":196,"line":3718},[14381],{"type":20,"tag":194,"props":14382,"children":14383},{"style":201},[14384],{"type":30,"value":14385},"                 * call the completeCallback with the fetched value.\n",{"type":20,"tag":194,"props":14387,"children":14388},{"class":196,"line":3743},[14389],{"type":20,"tag":194,"props":14390,"children":14391},{"style":201},[14392],{"type":30,"value":14393},"                 */\n",{"type":20,"tag":194,"props":14395,"children":14396},{"class":196,"line":3751},[14397,14401],{"type":20,"tag":194,"props":14398,"children":14399},{"style":252},[14400],{"type":30,"value":10474},{"type":20,"tag":194,"props":14402,"children":14403},{"style":264},[14404],{"type":30,"value":595},{"type":20,"tag":194,"props":14406,"children":14407},{"class":196,"line":3772},[14408,14413,14417,14421,14425,14429,14433,14438],{"type":20,"tag":194,"props":14409,"children":14410},{"style":258},[14411],{"type":30,"value":14412},"                    send",{"type":20,"tag":194,"props":14414,"children":14415},{"style":264},[14416],{"type":30,"value":1554},{"type":20,"tag":194,"props":14418,"children":14419},{"style":252},[14420],{"type":30,"value":393},{"type":20,"tag":194,"props":14422,"children":14423},{"style":264},[14424],{"type":30,"value":403},{"type":20,"tag":194,"props":14426,"children":14427},{"style":406},[14428],{"type":30,"value":1501},{"type":20,"tag":194,"props":14430,"children":14431},{"style":264},[14432],{"type":30,"value":414},{"type":20,"tag":194,"props":14434,"children":14435},{"style":406},[14436],{"type":30,"value":14437},"completeCallback",{"type":20,"tag":194,"props":14439,"children":14440},{"style":264},[14441],{"type":30,"value":442},{"type":20,"tag":194,"props":14443,"children":14444},{"class":196,"line":3781},[14445,14450,14454,14459,14463,14467,14471,14475,14480],{"type":20,"tag":194,"props":14446,"children":14447},{"style":264},[14448],{"type":30,"value":14449},"                        $.jidb.",{"type":20,"tag":194,"props":14451,"children":14452},{"style":258},[14453],{"type":30,"value":3518},{"type":20,"tag":194,"props":14455,"children":14456},{"style":264},[14457],{"type":30,"value":14458},"(cacheKey).",{"type":20,"tag":194,"props":14460,"children":14461},{"style":258},[14462],{"type":30,"value":4496},{"type":20,"tag":194,"props":14464,"children":14465},{"style":264},[14466],{"type":30,"value":403},{"type":20,"tag":194,"props":14468,"children":14469},{"style":252},[14470],{"type":30,"value":393},{"type":20,"tag":194,"props":14472,"children":14473},{"style":264},[14474],{"type":30,"value":403},{"type":20,"tag":194,"props":14476,"children":14477},{"style":406},[14478],{"type":30,"value":14479},"result",{"type":20,"tag":194,"props":14481,"children":14482},{"style":264},[14483],{"type":30,"value":4253},{"type":20,"tag":194,"props":14485,"children":14486},{"class":196,"line":3790},[14487,14492,14496,14500],{"type":20,"tag":194,"props":14488,"children":14489},{"style":252},[14490],{"type":30,"value":14491},"                            var",{"type":20,"tag":194,"props":14493,"children":14494},{"style":264},[14495],{"type":30,"value":1022},{"type":20,"tag":194,"props":14497,"children":14498},{"style":252},[14499],{"type":30,"value":461},{"type":20,"tag":194,"props":14501,"children":14502},{"style":264},[14503],{"type":30,"value":14504}," {};\n",{"type":20,"tag":194,"props":14506,"children":14507},{"class":196,"line":3835},[14508,14513,14517],{"type":20,"tag":194,"props":14509,"children":14510},{"style":264},[14511],{"type":30,"value":14512},"                            response[result.dataType] ",{"type":20,"tag":194,"props":14514,"children":14515},{"style":252},[14516],{"type":30,"value":461},{"type":20,"tag":194,"props":14518,"children":14519},{"style":264},[14520],{"type":30,"value":14521}," result.data;\n",{"type":20,"tag":194,"props":14523,"children":14524},{"class":196,"line":3843},[14525,14530,14534,14538,14542,14546,14551,14555],{"type":20,"tag":194,"props":14526,"children":14527},{"style":258},[14528],{"type":30,"value":14529},"                            completeCallback",{"type":20,"tag":194,"props":14531,"children":14532},{"style":264},[14533],{"type":30,"value":403},{"type":20,"tag":194,"props":14535,"children":14536},{"style":680},[14537],{"type":30,"value":1070},{"type":20,"tag":194,"props":14539,"children":14540},{"style":264},[14541],{"type":30,"value":414},{"type":20,"tag":194,"props":14543,"children":14544},{"style":506},[14545],{"type":30,"value":1088},{"type":20,"tag":194,"props":14547,"children":14548},{"style":264},[14549],{"type":30,"value":14550},", response, ",{"type":20,"tag":194,"props":14552,"children":14553},{"style":506},[14554],{"type":30,"value":12112},{"type":20,"tag":194,"props":14556,"children":14557},{"style":264},[14558],{"type":30,"value":1649},{"type":20,"tag":194,"props":14560,"children":14561},{"class":196,"line":3851},[14562,14567,14571,14575,14579],{"type":20,"tag":194,"props":14563,"children":14564},{"style":264},[14565],{"type":30,"value":14566},"                        }).",{"type":20,"tag":194,"props":14568,"children":14569},{"style":258},[14570],{"type":30,"value":4546},{"type":20,"tag":194,"props":14572,"children":14573},{"style":264},[14574],{"type":30,"value":403},{"type":20,"tag":194,"props":14576,"children":14577},{"style":252},[14578],{"type":30,"value":393},{"type":20,"tag":194,"props":14580,"children":14581},{"style":264},[14582],{"type":30,"value":4121},{"type":20,"tag":194,"props":14584,"children":14585},{"class":196,"line":3860},[14586,14590,14594,14598,14602,14607,14611,14616,14620,14624,14628],{"type":20,"tag":194,"props":14587,"children":14588},{"style":258},[14589],{"type":30,"value":14529},{"type":20,"tag":194,"props":14591,"children":14592},{"style":264},[14593],{"type":30,"value":403},{"type":20,"tag":194,"props":14595,"children":14596},{"style":680},[14597],{"type":30,"value":5943},{"type":20,"tag":194,"props":14599,"children":14600},{"style":264},[14601],{"type":30,"value":414},{"type":20,"tag":194,"props":14603,"children":14604},{"style":506},[14605],{"type":30,"value":14606},"'cache failure'",{"type":20,"tag":194,"props":14608,"children":14609},{"style":264},[14610],{"type":30,"value":414},{"type":20,"tag":194,"props":14612,"children":14613},{"style":252},[14614],{"type":30,"value":14615},"void",{"type":20,"tag":194,"props":14617,"children":14618},{"style":680},[14619],{"type":30,"value":3627},{"type":20,"tag":194,"props":14621,"children":14622},{"style":264},[14623],{"type":30,"value":414},{"type":20,"tag":194,"props":14625,"children":14626},{"style":506},[14627],{"type":30,"value":12112},{"type":20,"tag":194,"props":14629,"children":14630},{"style":264},[14631],{"type":30,"value":1649},{"type":20,"tag":194,"props":14633,"children":14634},{"class":196,"line":3869},[14635],{"type":20,"tag":194,"props":14636,"children":14637},{"style":264},[14638],{"type":30,"value":14639},"                        });\n",{"type":20,"tag":194,"props":14641,"children":14642},{"class":196,"line":3917},[14643],{"type":20,"tag":194,"props":14644,"children":14645},{"style":264},[14646],{"type":30,"value":14647},"                    },\n",{"type":20,"tag":194,"props":14649,"children":14650},{"class":196,"line":3934},[14651,14656,14660,14664],{"type":20,"tag":194,"props":14652,"children":14653},{"style":258},[14654],{"type":30,"value":14655},"                    abort",{"type":20,"tag":194,"props":14657,"children":14658},{"style":264},[14659],{"type":30,"value":1554},{"type":20,"tag":194,"props":14661,"children":14662},{"style":252},[14663],{"type":30,"value":393},{"type":20,"tag":194,"props":14665,"children":14666},{"style":264},[14667],{"type":30,"value":14668},"() {\n",{"type":20,"tag":194,"props":14670,"children":14671},{"class":196,"line":3943},[14672,14677,14681,14685,14690],{"type":20,"tag":194,"props":14673,"children":14674},{"style":264},[14675],{"type":30,"value":14676},"                        console.",{"type":20,"tag":194,"props":14678,"children":14679},{"style":258},[14680],{"type":30,"value":796},{"type":20,"tag":194,"props":14682,"children":14683},{"style":264},[14684],{"type":30,"value":403},{"type":20,"tag":194,"props":14686,"children":14687},{"style":506},[14688],{"type":30,"value":14689},"\"Aborted ajax transport for caching.\"",{"type":20,"tag":194,"props":14691,"children":14692},{"style":264},[14693],{"type":30,"value":1649},{"type":20,"tag":194,"props":14695,"children":14696},{"class":196,"line":11484},[14697],{"type":20,"tag":194,"props":14698,"children":14699},{"style":264},[14700],{"type":30,"value":14701},"                    }\n",{"type":20,"tag":194,"props":14703,"children":14704},{"class":196,"line":11492},[14705],{"type":20,"tag":194,"props":14706,"children":14707},{"style":264},[14708],{"type":30,"value":14709},"                };\n",{"type":20,"tag":194,"props":14711,"children":14712},{"class":196,"line":11500},[14713],{"type":20,"tag":194,"props":14714,"children":14715},{"style":264},[14716],{"type":30,"value":1121},{"type":20,"tag":194,"props":14718,"children":14719},{"class":196,"line":11509},[14720],{"type":20,"tag":194,"props":14721,"children":14722},{"style":264},[14723],{"type":30,"value":824},{"type":20,"tag":194,"props":14725,"children":14726},{"class":196,"line":11529},[14727],{"type":20,"tag":194,"props":14728,"children":14729},{"style":264},[14730],{"type":30,"value":833},{"type":20,"tag":194,"props":14732,"children":14733},{"class":196,"line":11537},[14734],{"type":20,"tag":194,"props":14735,"children":14736},{"style":264},[14737],{"type":30,"value":11901},{"type":20,"tag":21,"props":14739,"children":14740},{},[14741,14743,14749],{"type":30,"value":14742},"If you're acquainted with the Jalc plugin, this should look familiar. The main changes lie in the ",{"type":20,"tag":68,"props":14744,"children":14746},{"className":14745},[],[14747],{"type":30,"value":14748},"addToStorage",{"type":30,"value":14750}," function, which we call to actual store the values - notice that we need to handle both the case where we've hit an error in local storage (such as exceeding the storage limit), and potential errors responses from our IndexedDB wrapper - and the ajaxTransport we use to deliver the cached response which, as promised, uses our dirty little hack of relying on the synchronous nature of LocalStorage to tell us whether a key exists and, once we've asserted that we'll be delivering the transport for this request, taking our time with the asynchronous operation to actually fetch and return the requested data.",{"type":20,"tag":35,"props":14752,"children":14754},{"id":14753},"thats-it-folks",[14755],{"type":30,"value":14756},"That's it, folks",{"type":20,"tag":21,"props":14758,"children":14759},{},[14760,14762,14767,14769,14774],{"type":30,"value":14761},"This plugin should be considered ",{"type":20,"tag":4379,"props":14763,"children":14764},{},[14765],{"type":30,"value":14766},"experimental",{"type":30,"value":14768},"! It works as a proof of concept, but I wouldn't place it into production if I were you - it doesn't attempt to handle cases like Privacy mode in Firefox (where IndexedDB ",{"type":20,"tag":4379,"props":14770,"children":14771},{},[14772],{"type":30,"value":14773},"says",{"type":30,"value":14775}," it's available, but fails to function), no fallbacks, and weak-to-nonexistant error handling. Want to use it somewhere serious? Pull requests are welcome. :)",{"type":20,"tag":21,"props":14777,"children":14778},{},[14779,14781,14787],{"type":30,"value":14780},"Take a look at the new ",{"type":20,"tag":25,"props":14782,"children":14784},{"href":8779,"rel":14783},[50],[14785],{"type":30,"value":14786},"Jalic plugin on Github",{"type":30,"value":55},{"type":20,"tag":3951,"props":14789,"children":14790},{},[14791],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":14793},[14794,14797,14798],{"id":8788,"depth":216,"text":8791,"children":14795},[14796],{"id":8910,"depth":225,"text":8913},{"id":8984,"depth":216,"text":8987},{"id":14753,"depth":216,"text":14756},"content:ckeefer:2016-1:ajaxBinaryCaching.md","ckeefer/2016-1/ajaxBinaryCaching.md","ckeefer/2016-1/ajaxBinaryCaching",{"user":3970,"name":3971},{"_path":14804,"_dir":14805,"_draft":7,"_partial":7,"_locale":8,"title":14806,"description":14807,"publishDate":14808,"tags":14809,"excerpt":14807,"body":14810,"_type":3963,"_id":15170,"_source":3965,"_file":15171,"_stem":15172,"_extension":3968,"author":15173},"/ckeefer/2015-5/file-reader-chunking","2015-5","FileReader Chunking and Base64 DataURLs","In a hurry? You can now use our HUp jquery plugin to read files in a chunked fashion as data URLs. Hooray!","2015-12-15",[13,14],{"type":17,"children":14811,"toc":15165},[14812,14826,14831,14854,14860,14865,14916,14937,14945,14950,14955,14961,14966,14991,15018,15032,15037,15115,15120,15126,15131,15136,15148,15161],{"type":20,"tag":21,"props":14813,"children":14814},{},[14815,14817,14824],{"type":30,"value":14816},"In a hurry? You can now use our ",{"type":20,"tag":25,"props":14818,"children":14821},{"href":14819,"rel":14820},"https://github.com/SaneMethod/HUp",[50],[14822],{"type":30,"value":14823},"HUp jquery plugin",{"type":30,"value":14825}," to read files in a chunked fashion as data URLs. Hooray!",{"type":20,"tag":21,"props":14827,"children":14828},{},[14829],{"type":30,"value":14830},"Got a minute or two? Let's talk about file read chunking, data URLs and base 64.",{"type":20,"tag":21,"props":14832,"children":14833},{},[14834,14836,14843,14845,14852],{"type":30,"value":14835},"If you've been looking forward to the ",{"type":20,"tag":25,"props":14837,"children":14840},{"href":14838,"rel":14839},"https://artandlogic.com/2015/11/11029/",[50],[14841],{"type":30,"value":14842},"previously promised discussion",{"type":30,"value":14844}," about file reading/downloading to/uploading from ",{"type":20,"tag":25,"props":14846,"children":14849},{"href":14847,"rel":14848},"https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API",[50],[14850],{"type":30,"value":14851},"IndexedDb",{"type":30,"value":14853}," - well, keep looking forward, it's on the way. In the meantime, however, let's take a quick look at a problem and it's quick and easy solution, that emerged out of making file reading chunkable for the HUp plugin.",{"type":20,"tag":35,"props":14855,"children":14857},{"id":14856},"the-problem",[14858],{"type":30,"value":14859},"The Problem",{"type":20,"tag":21,"props":14861,"children":14862},{},[14863],{"type":30,"value":14864},"The HUp plugin has, as one of its goals, sensible defaults - such that a user can just call it against whatever element they want to make into a file reader/uploader drag-and-drop point, and presto! Everything works, and in a reasonable manner.",{"type":20,"tag":21,"props":14866,"children":14867},{},[14868,14870,14875,14877,14882,14884,14891,14893,14898,14900,14906,14908,14914],{"type":30,"value":14869},"When I added the ability to ",{"type":20,"tag":4379,"props":14871,"children":14872},{},[14873],{"type":30,"value":14874},"read",{"type":30,"value":14876}," files in chunks, to mirror and complement our ability to ",{"type":20,"tag":4379,"props":14878,"children":14879},{},[14880],{"type":30,"value":14881},"upload",{"type":30,"value":14883}," files in chunks, we hit a snag in regards to the above goal. Generally speaking, the expectation is that developers using the plugin to read files in will probably want to be able to use said file in the browser in some fashion, and one of the simplest representations that can be used directly in the browser is a base64-encoded ",{"type":20,"tag":25,"props":14885,"children":14888},{"href":14886,"rel":14887},"https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs",[50],[14889],{"type":30,"value":14890},"data URL",{"type":30,"value":14892},". You can expect to be able to pop it into the ",{"type":20,"tag":4379,"props":14894,"children":14895},{},[14896],{"type":30,"value":14897},"src",{"type":30,"value":14899}," attribute of a number of elements in a modern browser, and be able to do something with it right away. So, defaulting our ",{"type":20,"tag":68,"props":14901,"children":14903},{"className":14902},[],[14904],{"type":30,"value":14905},"read_method",{"type":30,"value":14907}," to ",{"type":20,"tag":68,"props":14909,"children":14911},{"className":14910},[],[14912],{"type":30,"value":14913},"readAsDataURL",{"type":30,"value":14915}," makes sense.",{"type":20,"tag":21,"props":14917,"children":14918},{},[14919,14921,14927,14929,14935],{"type":30,"value":14920},"However! Now that we're chunking file reads by default (since it offers benefits, some of which were discussed ",{"type":20,"tag":25,"props":14922,"children":14924},{"href":14838,"rel":14923},[50],[14925],{"type":30,"value":14926},"last time",{"type":30,"value":14928},"), if the file to be read is larger than our ",{"type":20,"tag":68,"props":14930,"children":14932},{"className":14931},[],[14933],{"type":30,"value":14934},"chunk_size",{"type":30,"value":14936}," (which defaults to 1MiB), than it will be read as a number of chunks, which will need to be reassembled to be used in a src attribute as a data URL. Small bit of extra work for the developer, but a little string manipulation and you're done, right?",{"type":20,"tag":21,"props":14938,"children":14939},{},[14940],{"type":20,"tag":5490,"props":14941,"children":14942},{},[14943],{"type":30,"value":14944},"Not quite.",{"type":20,"tag":21,"props":14946,"children":14947},{},[14948],{"type":30,"value":14949},"It's common knowledge that encoding binary data as base64 will result in an overall increase in size of about 33%. This is because, with a total of 26 different values, base64 can encode 6 bits per character (that is, the eight bits composing one character (in, for example, utf-8), are each used to represent 6 bits in the source binary).",{"type":20,"tag":21,"props":14951,"children":14952},{},[14953],{"type":30,"value":14954},"So what's the problem? We can end up with chunks that can't be trivially recombined, and the details we just discussed regarding how many bits per character we get in base64-encoding explains why - if we're not careful about where we slice the file chunks, we end up with each base64 chunk after the first out of alignment from the binary source. Attempting to simply concatenate them and use them will fail.",{"type":20,"tag":35,"props":14956,"children":14958},{"id":14957},"the-workaround",[14959],{"type":30,"value":14960},"The Workaround",{"type":20,"tag":21,"props":14962,"children":14963},{},[14964],{"type":30,"value":14965},"Recently, a user of the plugin brought up an unrelated problem, regarding the mime-type on the produced data URLs. In the process of fixing this, I started thinking about how chunking might affect the data URLs, and a few quick experiments showed me I was correct - chunking the files and encoding them as base64 caused problems. I didn't have the time to fix the issue at that moment, however, so I mentioned a workaround to said user.",{"type":20,"tag":21,"props":14967,"children":14968},{},[14969,14974,14976,14981,14983,14990],{"type":20,"tag":4379,"props":14970,"children":14971},{},[14972],{"type":30,"value":14973},"You",{"type":30,"value":14975},", lucky reader, don't ",{"type":20,"tag":4379,"props":14977,"children":14978},{},[14979],{"type":30,"value":14980},"need",{"type":30,"value":14982}," this workaround, since this issue is now addressed - however, it might be of future interest, particularly if you need/prefer to work with ",{"type":20,"tag":25,"props":14984,"children":14987},{"href":14985,"rel":14986},"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer",[50],[14988],{"type":30,"value":14989},"Array Buffers",{"type":30,"value":55},{"type":20,"tag":21,"props":14992,"children":14993},{},[14994,14996,15001,15003,15008,15010,15016],{"type":30,"value":14995},"Since using an Array Buffer means we don't need to worry about base64 encoding a file, we can slice and dice each chunk however we please, and concatenating the resulting array buffers poses no issue. So, instead of using ",{"type":20,"tag":68,"props":14997,"children":14999},{"className":14998},[],[15000],{"type":30,"value":14913},{"type":30,"value":15002}," as our ",{"type":20,"tag":68,"props":15004,"children":15006},{"className":15005},[],[15007],{"type":30,"value":14905},{"type":30,"value":15009},", I suggested this user employ the ",{"type":20,"tag":68,"props":15011,"children":15013},{"className":15012},[],[15014],{"type":30,"value":15015},"readAsArrayBuffer",{"type":30,"value":15017}," method instead.",{"type":20,"tag":21,"props":15019,"children":15020},{},[15021,15023,15030],{"type":30,"value":15022},"What if he wants to be able to display or otherwise use the read-in file in the browser? Well, we could convert the concatenated array buffers into base64, but a much more straightforward method is to create a new ",{"type":20,"tag":25,"props":15024,"children":15027},{"href":15025,"rel":15026},"https://developer.mozilla.org/en/docs/Web/API/Blob",[50],[15028],{"type":30,"value":15029},"Blob",{"type":30,"value":15031}," from the concatenated array buffers, and get an object url from said blob to display.",{"type":20,"tag":21,"props":15033,"children":15034},{},[15035],{"type":30,"value":15036},"This would look something like the following, assuming for the sake of example that you have three array buffers which we'll creatively name arr1, arr2 and arr3:",{"type":20,"tag":184,"props":15038,"children":15040},{"className":186,"code":15039,"language":188,"meta":8,"style":8},"var blob = new Blob([arr1, arr2, arr3], {type:'mime/type'}),\n    url = URL.createObjectURL(blob);\n",[15041],{"type":20,"tag":68,"props":15042,"children":15043},{"__ignoreMap":8},[15044,15084],{"type":20,"tag":194,"props":15045,"children":15046},{"class":196,"line":197},[15047,15051,15056,15060,15064,15069,15074,15079],{"type":20,"tag":194,"props":15048,"children":15049},{"style":252},[15050],{"type":30,"value":4057},{"type":20,"tag":194,"props":15052,"children":15053},{"style":264},[15054],{"type":30,"value":15055}," blob ",{"type":20,"tag":194,"props":15057,"children":15058},{"style":252},[15059],{"type":30,"value":461},{"type":20,"tag":194,"props":15061,"children":15062},{"style":252},[15063],{"type":30,"value":1031},{"type":20,"tag":194,"props":15065,"children":15066},{"style":258},[15067],{"type":30,"value":15068}," Blob",{"type":20,"tag":194,"props":15070,"children":15071},{"style":264},[15072],{"type":30,"value":15073},"([arr1, arr2, arr3], {type:",{"type":20,"tag":194,"props":15075,"children":15076},{"style":506},[15077],{"type":30,"value":15078},"'mime/type'",{"type":20,"tag":194,"props":15080,"children":15081},{"style":264},[15082],{"type":30,"value":15083},"}),\n",{"type":20,"tag":194,"props":15085,"children":15086},{"class":196,"line":207},[15087,15092,15096,15101,15105,15110],{"type":20,"tag":194,"props":15088,"children":15089},{"style":264},[15090],{"type":30,"value":15091},"    url ",{"type":20,"tag":194,"props":15093,"children":15094},{"style":252},[15095],{"type":30,"value":461},{"type":20,"tag":194,"props":15097,"children":15098},{"style":680},[15099],{"type":30,"value":15100}," URL",{"type":20,"tag":194,"props":15102,"children":15103},{"style":264},[15104],{"type":30,"value":55},{"type":20,"tag":194,"props":15106,"children":15107},{"style":258},[15108],{"type":30,"value":15109},"createObjectURL",{"type":20,"tag":194,"props":15111,"children":15112},{"style":264},[15113],{"type":30,"value":15114},"(blob);\n",{"type":20,"tag":21,"props":15116,"children":15117},{},[15118],{"type":30,"value":15119},"Pretty easy, right?",{"type":20,"tag":35,"props":15121,"children":15123},{"id":15122},"the-solution",[15124],{"type":30,"value":15125},"The Solution",{"type":20,"tag":21,"props":15127,"children":15128},{},[15129],{"type":30,"value":15130},"I wasn't entirely happy with having to suggest this workaround, however, so when I had an hour or so free to revisit the question, I tried a little experiment. Could it really be as simple, I wondered, as making sure our chunks were aligned to the nearest multiple of 6 (remembering, as mentioned above, that we get 6-bits per character)?",{"type":20,"tag":21,"props":15132,"children":15133},{},[15134],{"type":30,"value":15135},"Yes, yes it could be.",{"type":20,"tag":21,"props":15137,"children":15138},{},[15139,15141,15146],{"type":30,"value":15140},"So, the defaults for HUp can now remain blissfully unchanged, and chunking works just fine - when ",{"type":20,"tag":68,"props":15142,"children":15144},{"className":15143},[],[15145],{"type":30,"value":14913},{"type":30,"value":15147}," is specified as the read_method, the plugin will transparently alter the total size of each chunk to the nearest multiple of 6 until we reach the end of the file, ensuring that the resulting base64 remains aligned with the binary source, and allowing trivial recombination of the data URLs.",{"type":20,"tag":21,"props":15149,"children":15150},{},[15151,15153,15159],{"type":30,"value":15152},"I've also added a small convenience function to handle said recombination - check out the ",{"type":20,"tag":25,"props":15154,"children":15156},{"href":14819,"rel":15155},[50],[15157],{"type":30,"value":15158},"Github Repo",{"type":30,"value":15160}," for the details.",{"type":20,"tag":3951,"props":15162,"children":15163},{},[15164],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":15166},[15167,15168,15169],{"id":14856,"depth":216,"text":14859},{"id":14957,"depth":216,"text":14960},{"id":15122,"depth":216,"text":15125},"content:ckeefer:2015-5:file-reader-chunking.md","ckeefer/2015-5/file-reader-chunking.md","ckeefer/2015-5/file-reader-chunking",{"user":3970,"name":3971},{"_path":15175,"_dir":15176,"_draft":7,"_partial":7,"_locale":8,"title":15177,"description":15178,"publishDate":15179,"tags":15180,"excerpt":15178,"body":15181,"_type":3963,"_id":16860,"_source":3965,"_file":16861,"_stem":16862,"_extension":3968,"author":16863},"/ckeefer/2014-7/promises","2014-7","It's a (jQuery-style) Promise","Way back when I brought up the topic of promises (particularly, jQuery Deferred), and I promised we would come back to the topic someday.","2014-10-16",[13,14],{"type":17,"children":15182,"toc":16827},[15183,15194,15206,15212,15217,15235,15258,15272,15286,15291,15296,15309,15315,15321,15342,15347,15352,15358,15406,15410,15416,15628,15631,15637,16042,16045,16051,16065,16228,16231,16237,16249,16255,16261,16321,16326,16356,16362,16367,16372,16377,16396,16402,16407,16447,16452,16532,16535,16541,16553,16559,16564,16570,16574,16624,16629,16743,16746,16750,16823],{"type":20,"tag":21,"props":15184,"children":15185},{},[15186,15192],{"type":20,"tag":25,"props":15187,"children":15189},{"href":15188},"/search/jquery/ajax/user:ckeefer",[15190],{"type":30,"value":15191},"Way back when",{"type":30,"value":15193}," I brought up the topic of promises (particularly, jQuery Deferred), and I promised we would come back to the topic someday.",{"type":20,"tag":21,"props":15195,"children":15196},{},[15197,15199,15204],{"type":30,"value":15198},"Well, that promise has finally resolved, and this is the done block. Don't get it? Don't worry, all shall be explained. If you do get it, and wish there ",{"type":20,"tag":4379,"props":15200,"children":15201},{},[15202],{"type":30,"value":15203},"were",{"type":30,"value":15205}," a done block in the Promise spec... well, read on.",{"type":20,"tag":5510,"props":15207,"children":15209},{"id":15208},"native-promises",[15210],{"type":30,"value":15211},"Native Promises",{"type":20,"tag":21,"props":15213,"children":15214},{},[15215],{"type":30,"value":15216},"Promises are pretty great.",{"type":20,"tag":21,"props":15218,"children":15219},{},[15220,15222,15227,15229,15234],{"type":30,"value":15221},"A lot of time and effort has been expended on explaining why - which would suggest that the answer might not be immediately obvious to everyone, especially if you haven't spent too much time with ",{"type":20,"tag":5490,"props":15223,"children":15224},{},[15225],{"type":30,"value":15226},"pyramid code",{"type":30,"value":15228}," languishing in ",{"type":20,"tag":5490,"props":15230,"children":15231},{},[15232],{"type":30,"value":15233},"callback hell",{"type":30,"value":55},{"type":20,"tag":21,"props":15236,"children":15237},{},[15238,15240,15247,15249,15256],{"type":30,"value":15239},"For the curious, I've included some further reading at the end of this post that should help. For the rest, suffice to say that there are no less than ",{"type":20,"tag":25,"props":15241,"children":15244},{"href":15242,"rel":15243},"https://github.com/promises-aplus/promises-spec/blob/master/implementations.md",[50],[15245],{"type":30,"value":15246},"37 different javascript promise implementations",{"type":30,"value":15248}," - and these are just the ones that conform to the ",{"type":20,"tag":25,"props":15250,"children":15253},{"href":15251,"rel":15252},"https://promisesaplus.com/",[50],[15254],{"type":30,"value":15255},"Promises/A+ spec",{"type":30,"value":15257},". Obviously, a lot of people are excited about promises.",{"type":20,"tag":21,"props":15259,"children":15260},{},[15261,15263,15270],{"type":30,"value":15262},"Most exciting for those interested in promises in js, however, is the fact that they'll soon be ",{"type":20,"tag":25,"props":15264,"children":15267},{"href":15265,"rel":15266},"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise",[50],[15268],{"type":30,"value":15269},"available natively in a browser near you",{"type":30,"value":15271},", if indeed they're not already. The native implementations will be compliant to the spec, faster (as a result of being native code), and available without the inclusion of an additional library. Yay!",{"type":20,"tag":21,"props":15273,"children":15274},{},[15275,15277,15284],{"type":30,"value":15276},"However, if you head to the list of promise implementations linked above and scan through them, including those listed as part of frameworks, you'll notice that ",{"type":20,"tag":25,"props":15278,"children":15281},{"href":15279,"rel":15280},"http://api.jquery.com/category/deferred-object/",[50],[15282],{"type":30,"value":15283},"jQuery's Deferred",{"type":30,"value":15285}," isn't among them.",{"type":20,"tag":21,"props":15287,"children":15288},{},[15289],{"type":30,"value":15290},"You see, while jQuery's Deferred plays nicely internally, it isn't compliant with the Promises/A+ spec that all the cool kids are using. If we're including jQuery in our project, we could just keep on using Deferred - but what if we really like jQuery's Deferred API, but want to take advantage of native promises?",{"type":20,"tag":21,"props":15292,"children":15293},{},[15294],{"type":30,"value":15295},"Sounds like a problem. Let's solve it, shall we? I've written a little wrapper lib named Defer (original, I know), that let's you use native promises with an API very similar (although not identical!) to the jQuery Deferred API. Details below.",{"type":20,"tag":21,"props":15297,"children":15298},{},[15299,15301,15307],{"type":30,"value":15300},"Head to the ",{"type":20,"tag":25,"props":15302,"children":15305},{"href":15303,"rel":15304},"https://github.com/SaneMethod/Defer",[50],[15306],{"type":30,"value":1247},{"type":30,"value":15308}," for more details, and to see the code.",{"type":20,"tag":5510,"props":15310,"children":15312},{"id":15311},"defer",[15313],{"type":30,"value":15314},"Defer",{"type":20,"tag":35,"props":15316,"children":15318},{"id":15317},"native-promise-api-wrapper",[15319],{"type":30,"value":15320},"Native Promise API Wrapper",{"type":20,"tag":21,"props":15322,"children":15323},{},[15324,15326,15331,15333,15340],{"type":30,"value":15325},"Defer is for those who like the jQuery API for ",{"type":20,"tag":25,"props":15327,"children":15329},{"href":15279,"rel":15328},[50],[15330],{"type":30,"value":9123},{"type":30,"value":15332},", but want to take advantage of the new, native Promise API built into modern versions of Firefox, Chrome, Opera and Safari (but not ie - see ",{"type":20,"tag":25,"props":15334,"children":15337},{"href":15335,"rel":15336},"http://caniuse.com/#feat=promises",[50],[15338],{"type":30,"value":15339},"caniuse",{"type":30,"value":15341}," for up-to-date details).",{"type":20,"tag":21,"props":15343,"children":15344},{},[15345],{"type":30,"value":15346},"Defer is also for those who'd like a 'done' function (that is, one which executes after the entire promise chain is completed, which doesn't currently exist in the Promise specification), for those who like to call resolve or reject from outside the Promise constructor, and for those who consider one function per composition ideal, and two or more unbearably ugly (with the exception of .then, because reasons). See below for some more details on this.",{"type":20,"tag":21,"props":15348,"children":15349},{},[15350],{"type":30,"value":15351},"Defer is in an immediately-invoked closure, so you can pass whatever context you'd like it to live in to it. By default, it attaches itself to the global window.",{"type":20,"tag":5510,"props":15353,"children":15355},{"id":15354},"usage",[15356],{"type":30,"value":15357},"Usage:",{"type":20,"tag":5326,"props":15359,"children":15360},{},[15361,15370,15379,15388,15397],{"type":20,"tag":5330,"props":15362,"children":15363},{},[15364],{"type":20,"tag":25,"props":15365,"children":15367},{"href":15366},"#simple-example",[15368],{"type":30,"value":15369},"Simple Example",{"type":20,"tag":5330,"props":15371,"children":15372},{},[15373],{"type":20,"tag":25,"props":15374,"children":15376},{"href":15375},"#another-example",[15377],{"type":30,"value":15378},"Another Example",{"type":20,"tag":5330,"props":15380,"children":15381},{},[15382],{"type":20,"tag":25,"props":15383,"children":15385},{"href":15384},"#ajax-example",[15386],{"type":30,"value":15387},"Ajax Example",{"type":20,"tag":5330,"props":15389,"children":15390},{},[15391],{"type":20,"tag":25,"props":15392,"children":15394},{"href":15393},"#native-comparison",[15395],{"type":30,"value":15396},"Comparison with Native API",{"type":20,"tag":5330,"props":15398,"children":15399},{},[15400],{"type":20,"tag":25,"props":15401,"children":15403},{"href":15402},"#jquery-comparison",[15404],{"type":30,"value":15405},"Comparison with jQuery API",{"type":20,"tag":15407,"props":15408,"children":15409},"hr",{},[],{"type":20,"tag":35,"props":15411,"children":15413},{"id":15412},"simple-example",[15414],{"type":30,"value":15415},"Simple Example:",{"type":20,"tag":184,"props":15417,"children":15419},{"className":186,"code":15418,"language":188,"meta":8,"style":8},"var defer = Defer();\ndefer.then(function(value){\n// Do something with the value\n// Returning an altered value will propagate to succeeding then and done calls\n}).done(function(value){\n// Called when the promise chain is fully resolved\n}).fail(function(error){\n// Called when the promise is rejected, with any value passed into reject\n// A nice convention is to make that value a new Error()\n});\n\n// ... Do your async stuff ...\ndefer.resolve(value /* some value your async stuff gave you */);\n",[15420],{"type":20,"tag":68,"props":15421,"children":15422},{"__ignoreMap":8},[15423,15447,15479,15487,15495,15526,15534,15565,15573,15581,15588,15595,15603],{"type":20,"tag":194,"props":15424,"children":15425},{"class":196,"line":197},[15426,15430,15434,15438,15443],{"type":20,"tag":194,"props":15427,"children":15428},{"style":252},[15429],{"type":30,"value":4057},{"type":20,"tag":194,"props":15431,"children":15432},{"style":264},[15433],{"type":30,"value":10298},{"type":20,"tag":194,"props":15435,"children":15436},{"style":252},[15437],{"type":30,"value":461},{"type":20,"tag":194,"props":15439,"children":15440},{"style":258},[15441],{"type":30,"value":15442}," Defer",{"type":20,"tag":194,"props":15444,"children":15445},{"style":264},[15446],{"type":30,"value":539},{"type":20,"tag":194,"props":15448,"children":15449},{"class":196,"line":207},[15450,15455,15459,15463,15467,15471,15475],{"type":20,"tag":194,"props":15451,"children":15452},{"style":264},[15453],{"type":30,"value":15454},"defer.",{"type":20,"tag":194,"props":15456,"children":15457},{"style":258},[15458],{"type":30,"value":572},{"type":20,"tag":194,"props":15460,"children":15461},{"style":264},[15462],{"type":30,"value":403},{"type":20,"tag":194,"props":15464,"children":15465},{"style":252},[15466],{"type":30,"value":393},{"type":20,"tag":194,"props":15468,"children":15469},{"style":264},[15470],{"type":30,"value":403},{"type":20,"tag":194,"props":15472,"children":15473},{"style":406},[15474],{"type":30,"value":997},{"type":20,"tag":194,"props":15476,"children":15477},{"style":264},[15478],{"type":30,"value":4253},{"type":20,"tag":194,"props":15480,"children":15481},{"class":196,"line":216},[15482],{"type":20,"tag":194,"props":15483,"children":15484},{"style":201},[15485],{"type":30,"value":15486},"// Do something with the value\n",{"type":20,"tag":194,"props":15488,"children":15489},{"class":196,"line":225},[15490],{"type":20,"tag":194,"props":15491,"children":15492},{"style":201},[15493],{"type":30,"value":15494},"// Returning an altered value will propagate to succeeding then and done calls\n",{"type":20,"tag":194,"props":15496,"children":15497},{"class":196,"line":234},[15498,15502,15506,15510,15514,15518,15522],{"type":20,"tag":194,"props":15499,"children":15500},{"style":264},[15501],{"type":30,"value":4491},{"type":20,"tag":194,"props":15503,"children":15504},{"style":258},[15505],{"type":30,"value":4496},{"type":20,"tag":194,"props":15507,"children":15508},{"style":264},[15509],{"type":30,"value":403},{"type":20,"tag":194,"props":15511,"children":15512},{"style":252},[15513],{"type":30,"value":393},{"type":20,"tag":194,"props":15515,"children":15516},{"style":264},[15517],{"type":30,"value":403},{"type":20,"tag":194,"props":15519,"children":15520},{"style":406},[15521],{"type":30,"value":997},{"type":20,"tag":194,"props":15523,"children":15524},{"style":264},[15525],{"type":30,"value":4253},{"type":20,"tag":194,"props":15527,"children":15528},{"class":196,"line":243},[15529],{"type":20,"tag":194,"props":15530,"children":15531},{"style":201},[15532],{"type":30,"value":15533},"// Called when the promise chain is fully resolved\n",{"type":20,"tag":194,"props":15535,"children":15536},{"class":196,"line":275},[15537,15541,15545,15549,15553,15557,15561],{"type":20,"tag":194,"props":15538,"children":15539},{"style":264},[15540],{"type":30,"value":4491},{"type":20,"tag":194,"props":15542,"children":15543},{"style":258},[15544],{"type":30,"value":4546},{"type":20,"tag":194,"props":15546,"children":15547},{"style":264},[15548],{"type":30,"value":403},{"type":20,"tag":194,"props":15550,"children":15551},{"style":252},[15552],{"type":30,"value":393},{"type":20,"tag":194,"props":15554,"children":15555},{"style":264},[15556],{"type":30,"value":403},{"type":20,"tag":194,"props":15558,"children":15559},{"style":406},[15560],{"type":30,"value":4398},{"type":20,"tag":194,"props":15562,"children":15563},{"style":264},[15564],{"type":30,"value":4253},{"type":20,"tag":194,"props":15566,"children":15567},{"class":196,"line":284},[15568],{"type":20,"tag":194,"props":15569,"children":15570},{"style":201},[15571],{"type":30,"value":15572},"// Called when the promise is rejected, with any value passed into reject\n",{"type":20,"tag":194,"props":15574,"children":15575},{"class":196,"line":311},[15576],{"type":20,"tag":194,"props":15577,"children":15578},{"style":201},[15579],{"type":30,"value":15580},"// A nice convention is to make that value a new Error()\n",{"type":20,"tag":194,"props":15582,"children":15583},{"class":196,"line":320},[15584],{"type":20,"tag":194,"props":15585,"children":15586},{"style":264},[15587],{"type":30,"value":4204},{"type":20,"tag":194,"props":15589,"children":15590},{"class":196,"line":347},[15591],{"type":20,"tag":194,"props":15592,"children":15593},{"emptyLinePlaceholder":546},[15594],{"type":30,"value":549},{"type":20,"tag":194,"props":15596,"children":15597},{"class":196,"line":356},[15598],{"type":20,"tag":194,"props":15599,"children":15600},{"style":201},[15601],{"type":30,"value":15602},"// ... Do your async stuff ...\n",{"type":20,"tag":194,"props":15604,"children":15605},{"class":196,"line":378},[15606,15610,15614,15619,15624],{"type":20,"tag":194,"props":15607,"children":15608},{"style":264},[15609],{"type":30,"value":15454},{"type":20,"tag":194,"props":15611,"children":15612},{"style":258},[15613],{"type":30,"value":1177},{"type":20,"tag":194,"props":15615,"children":15616},{"style":264},[15617],{"type":30,"value":15618},"(value ",{"type":20,"tag":194,"props":15620,"children":15621},{"style":201},[15622],{"type":30,"value":15623},"/* some value your async stuff gave you */",{"type":20,"tag":194,"props":15625,"children":15626},{"style":264},[15627],{"type":30,"value":1649},{"type":20,"tag":15407,"props":15629,"children":15630},{},[],{"type":20,"tag":35,"props":15632,"children":15634},{"id":15633},"another-example",[15635],{"type":30,"value":15636},"Another Example:",{"type":20,"tag":184,"props":15638,"children":15640},{"className":186,"code":15639,"language":188,"meta":8,"style":8},"var p2 = Defer(),\np1 = Defer();\n\np2.then(function (value) {\n    console.log(value); // 1\n    return value + 1;\n}).done(function(value){\n    console.log(value); // 3\n}).then(function (value) {\n    console.log(value); // 2\n    return value + 1;\n});\n\np2.resolve(1);\np1.resolve(2);\n\nPromise.all([p2, p1]).then(function(vals){\n    console.log(vals); // [3, 2]\n});\n",[15641],{"type":20,"tag":68,"props":15642,"children":15643},{"__ignoreMap":8},[15644,15668,15688,15695,15727,15748,15773,15804,15824,15855,15875,15898,15905,15912,15935,15960,15967,16014,16035],{"type":20,"tag":194,"props":15645,"children":15646},{"class":196,"line":197},[15647,15651,15656,15660,15664],{"type":20,"tag":194,"props":15648,"children":15649},{"style":252},[15650],{"type":30,"value":4057},{"type":20,"tag":194,"props":15652,"children":15653},{"style":264},[15654],{"type":30,"value":15655}," p2 ",{"type":20,"tag":194,"props":15657,"children":15658},{"style":252},[15659],{"type":30,"value":461},{"type":20,"tag":194,"props":15661,"children":15662},{"style":258},[15663],{"type":30,"value":15442},{"type":20,"tag":194,"props":15665,"children":15666},{"style":264},[15667],{"type":30,"value":476},{"type":20,"tag":194,"props":15669,"children":15670},{"class":196,"line":207},[15671,15676,15680,15684],{"type":20,"tag":194,"props":15672,"children":15673},{"style":264},[15674],{"type":30,"value":15675},"p1 ",{"type":20,"tag":194,"props":15677,"children":15678},{"style":252},[15679],{"type":30,"value":461},{"type":20,"tag":194,"props":15681,"children":15682},{"style":258},[15683],{"type":30,"value":15442},{"type":20,"tag":194,"props":15685,"children":15686},{"style":264},[15687],{"type":30,"value":539},{"type":20,"tag":194,"props":15689,"children":15690},{"class":196,"line":216},[15691],{"type":20,"tag":194,"props":15692,"children":15693},{"emptyLinePlaceholder":546},[15694],{"type":30,"value":549},{"type":20,"tag":194,"props":15696,"children":15697},{"class":196,"line":225},[15698,15703,15707,15711,15715,15719,15723],{"type":20,"tag":194,"props":15699,"children":15700},{"style":264},[15701],{"type":30,"value":15702},"p2.",{"type":20,"tag":194,"props":15704,"children":15705},{"style":258},[15706],{"type":30,"value":572},{"type":20,"tag":194,"props":15708,"children":15709},{"style":264},[15710],{"type":30,"value":403},{"type":20,"tag":194,"props":15712,"children":15713},{"style":252},[15714],{"type":30,"value":393},{"type":20,"tag":194,"props":15716,"children":15717},{"style":264},[15718],{"type":30,"value":1172},{"type":20,"tag":194,"props":15720,"children":15721},{"style":406},[15722],{"type":30,"value":997},{"type":20,"tag":194,"props":15724,"children":15725},{"style":264},[15726],{"type":30,"value":442},{"type":20,"tag":194,"props":15728,"children":15729},{"class":196,"line":234},[15730,15734,15738,15743],{"type":20,"tag":194,"props":15731,"children":15732},{"style":264},[15733],{"type":30,"value":4187},{"type":20,"tag":194,"props":15735,"children":15736},{"style":258},[15737],{"type":30,"value":796},{"type":20,"tag":194,"props":15739,"children":15740},{"style":264},[15741],{"type":30,"value":15742},"(value); ",{"type":20,"tag":194,"props":15744,"children":15745},{"style":201},[15746],{"type":30,"value":15747},"// 1\n",{"type":20,"tag":194,"props":15749,"children":15750},{"class":196,"line":243},[15751,15755,15760,15764,15769],{"type":20,"tag":194,"props":15752,"children":15753},{"style":252},[15754],{"type":30,"value":850},{"type":20,"tag":194,"props":15756,"children":15757},{"style":264},[15758],{"type":30,"value":15759}," value ",{"type":20,"tag":194,"props":15761,"children":15762},{"style":252},[15763],{"type":30,"value":649},{"type":20,"tag":194,"props":15765,"children":15766},{"style":680},[15767],{"type":30,"value":15768}," 1",{"type":20,"tag":194,"props":15770,"children":15771},{"style":264},[15772],{"type":30,"value":1384},{"type":20,"tag":194,"props":15774,"children":15775},{"class":196,"line":275},[15776,15780,15784,15788,15792,15796,15800],{"type":20,"tag":194,"props":15777,"children":15778},{"style":264},[15779],{"type":30,"value":4491},{"type":20,"tag":194,"props":15781,"children":15782},{"style":258},[15783],{"type":30,"value":4496},{"type":20,"tag":194,"props":15785,"children":15786},{"style":264},[15787],{"type":30,"value":403},{"type":20,"tag":194,"props":15789,"children":15790},{"style":252},[15791],{"type":30,"value":393},{"type":20,"tag":194,"props":15793,"children":15794},{"style":264},[15795],{"type":30,"value":403},{"type":20,"tag":194,"props":15797,"children":15798},{"style":406},[15799],{"type":30,"value":997},{"type":20,"tag":194,"props":15801,"children":15802},{"style":264},[15803],{"type":30,"value":4253},{"type":20,"tag":194,"props":15805,"children":15806},{"class":196,"line":284},[15807,15811,15815,15819],{"type":20,"tag":194,"props":15808,"children":15809},{"style":264},[15810],{"type":30,"value":4187},{"type":20,"tag":194,"props":15812,"children":15813},{"style":258},[15814],{"type":30,"value":796},{"type":20,"tag":194,"props":15816,"children":15817},{"style":264},[15818],{"type":30,"value":15742},{"type":20,"tag":194,"props":15820,"children":15821},{"style":201},[15822],{"type":30,"value":15823},"// 3\n",{"type":20,"tag":194,"props":15825,"children":15826},{"class":196,"line":311},[15827,15831,15835,15839,15843,15847,15851],{"type":20,"tag":194,"props":15828,"children":15829},{"style":264},[15830],{"type":30,"value":4491},{"type":20,"tag":194,"props":15832,"children":15833},{"style":258},[15834],{"type":30,"value":572},{"type":20,"tag":194,"props":15836,"children":15837},{"style":264},[15838],{"type":30,"value":403},{"type":20,"tag":194,"props":15840,"children":15841},{"style":252},[15842],{"type":30,"value":393},{"type":20,"tag":194,"props":15844,"children":15845},{"style":264},[15846],{"type":30,"value":1172},{"type":20,"tag":194,"props":15848,"children":15849},{"style":406},[15850],{"type":30,"value":997},{"type":20,"tag":194,"props":15852,"children":15853},{"style":264},[15854],{"type":30,"value":442},{"type":20,"tag":194,"props":15856,"children":15857},{"class":196,"line":320},[15858,15862,15866,15870],{"type":20,"tag":194,"props":15859,"children":15860},{"style":264},[15861],{"type":30,"value":4187},{"type":20,"tag":194,"props":15863,"children":15864},{"style":258},[15865],{"type":30,"value":796},{"type":20,"tag":194,"props":15867,"children":15868},{"style":264},[15869],{"type":30,"value":15742},{"type":20,"tag":194,"props":15871,"children":15872},{"style":201},[15873],{"type":30,"value":15874},"// 2\n",{"type":20,"tag":194,"props":15876,"children":15877},{"class":196,"line":347},[15878,15882,15886,15890,15894],{"type":20,"tag":194,"props":15879,"children":15880},{"style":252},[15881],{"type":30,"value":850},{"type":20,"tag":194,"props":15883,"children":15884},{"style":264},[15885],{"type":30,"value":15759},{"type":20,"tag":194,"props":15887,"children":15888},{"style":252},[15889],{"type":30,"value":649},{"type":20,"tag":194,"props":15891,"children":15892},{"style":680},[15893],{"type":30,"value":15768},{"type":20,"tag":194,"props":15895,"children":15896},{"style":264},[15897],{"type":30,"value":1384},{"type":20,"tag":194,"props":15899,"children":15900},{"class":196,"line":356},[15901],{"type":20,"tag":194,"props":15902,"children":15903},{"style":264},[15904],{"type":30,"value":4204},{"type":20,"tag":194,"props":15906,"children":15907},{"class":196,"line":378},[15908],{"type":20,"tag":194,"props":15909,"children":15910},{"emptyLinePlaceholder":546},[15911],{"type":30,"value":549},{"type":20,"tag":194,"props":15913,"children":15914},{"class":196,"line":387},[15915,15919,15923,15927,15931],{"type":20,"tag":194,"props":15916,"children":15917},{"style":264},[15918],{"type":30,"value":15702},{"type":20,"tag":194,"props":15920,"children":15921},{"style":258},[15922],{"type":30,"value":1177},{"type":20,"tag":194,"props":15924,"children":15925},{"style":264},[15926],{"type":30,"value":403},{"type":20,"tag":194,"props":15928,"children":15929},{"style":680},[15930],{"type":30,"value":9401},{"type":20,"tag":194,"props":15932,"children":15933},{"style":264},[15934],{"type":30,"value":1649},{"type":20,"tag":194,"props":15936,"children":15937},{"class":196,"line":445},[15938,15943,15947,15951,15956],{"type":20,"tag":194,"props":15939,"children":15940},{"style":264},[15941],{"type":30,"value":15942},"p1.",{"type":20,"tag":194,"props":15944,"children":15945},{"style":258},[15946],{"type":30,"value":1177},{"type":20,"tag":194,"props":15948,"children":15949},{"style":264},[15950],{"type":30,"value":403},{"type":20,"tag":194,"props":15952,"children":15953},{"style":680},[15954],{"type":30,"value":15955},"2",{"type":20,"tag":194,"props":15957,"children":15958},{"style":264},[15959],{"type":30,"value":1649},{"type":20,"tag":194,"props":15961,"children":15962},{"class":196,"line":479},[15963],{"type":20,"tag":194,"props":15964,"children":15965},{"emptyLinePlaceholder":546},[15966],{"type":30,"value":549},{"type":20,"tag":194,"props":15968,"children":15969},{"class":196,"line":542},[15970,15975,15979,15984,15989,15993,15997,16001,16005,16010],{"type":20,"tag":194,"props":15971,"children":15972},{"style":680},[15973],{"type":30,"value":15974},"Promise",{"type":20,"tag":194,"props":15976,"children":15977},{"style":264},[15978],{"type":30,"value":55},{"type":20,"tag":194,"props":15980,"children":15981},{"style":258},[15982],{"type":30,"value":15983},"all",{"type":20,"tag":194,"props":15985,"children":15986},{"style":264},[15987],{"type":30,"value":15988},"([p2, p1]).",{"type":20,"tag":194,"props":15990,"children":15991},{"style":258},[15992],{"type":30,"value":572},{"type":20,"tag":194,"props":15994,"children":15995},{"style":264},[15996],{"type":30,"value":403},{"type":20,"tag":194,"props":15998,"children":15999},{"style":252},[16000],{"type":30,"value":393},{"type":20,"tag":194,"props":16002,"children":16003},{"style":264},[16004],{"type":30,"value":403},{"type":20,"tag":194,"props":16006,"children":16007},{"style":406},[16008],{"type":30,"value":16009},"vals",{"type":20,"tag":194,"props":16011,"children":16012},{"style":264},[16013],{"type":30,"value":4253},{"type":20,"tag":194,"props":16015,"children":16016},{"class":196,"line":552},[16017,16021,16025,16030],{"type":20,"tag":194,"props":16018,"children":16019},{"style":264},[16020],{"type":30,"value":4187},{"type":20,"tag":194,"props":16022,"children":16023},{"style":258},[16024],{"type":30,"value":796},{"type":20,"tag":194,"props":16026,"children":16027},{"style":264},[16028],{"type":30,"value":16029},"(vals); ",{"type":20,"tag":194,"props":16031,"children":16032},{"style":201},[16033],{"type":30,"value":16034},"// [3, 2]\n",{"type":20,"tag":194,"props":16036,"children":16037},{"class":196,"line":598},[16038],{"type":20,"tag":194,"props":16039,"children":16040},{"style":264},[16041],{"type":30,"value":4204},{"type":20,"tag":15407,"props":16043,"children":16044},{},[],{"type":20,"tag":35,"props":16046,"children":16048},{"id":16047},"ajax-example",[16049],{"type":30,"value":16050},"Ajax Example:",{"type":20,"tag":21,"props":16052,"children":16053},{},[16054,16056,16063],{"type":30,"value":16055},"See the ",{"type":20,"tag":25,"props":16057,"children":16060},{"href":16058,"rel":16059},"https://github.com/SaneMethod/Defer/blob/master/DeferAjaxExample.js",[50],[16061],{"type":30,"value":16062},"ajax example",{"type":30,"value":16064}," for the ajax wrapper being used below.",{"type":20,"tag":184,"props":16066,"children":16068},{"className":186,"code":16067,"language":188,"meta":8,"style":8},"ajax({\n    url:/somewhere/,\n    type:GET,\n    dataType:arraybuffer\n}).then(function(res){\n    // alter the result in someway and return it\n    return res;\n}).done(function(res){\n    // Do something with the result which was altered in the then block.\n});\n",[16069],{"type":20,"tag":68,"props":16070,"children":16071},{"__ignoreMap":8},[16072,16083,16107,16123,16131,16162,16170,16182,16213,16221],{"type":20,"tag":194,"props":16073,"children":16074},{"class":196,"line":197},[16075,16079],{"type":20,"tag":194,"props":16076,"children":16077},{"style":258},[16078],{"type":30,"value":4432},{"type":20,"tag":194,"props":16080,"children":16081},{"style":264},[16082],{"type":30,"value":4437},{"type":20,"tag":194,"props":16084,"children":16085},{"class":196,"line":207},[16086,16090,16094,16099,16103],{"type":20,"tag":194,"props":16087,"children":16088},{"style":264},[16089],{"type":30,"value":4462},{"type":20,"tag":194,"props":16091,"children":16092},{"style":506},[16093],{"type":30,"value":12085},{"type":20,"tag":194,"props":16095,"children":16096},{"style":12088},[16097],{"type":30,"value":16098},"somewhere",{"type":20,"tag":194,"props":16100,"children":16101},{"style":506},[16102],{"type":30,"value":12085},{"type":20,"tag":194,"props":16104,"children":16105},{"style":264},[16106],{"type":30,"value":1075},{"type":20,"tag":194,"props":16108,"children":16109},{"class":196,"line":216},[16110,16114,16119],{"type":20,"tag":194,"props":16111,"children":16112},{"style":264},[16113],{"type":30,"value":4445},{"type":20,"tag":194,"props":16115,"children":16116},{"style":680},[16117],{"type":30,"value":16118},"GET",{"type":20,"tag":194,"props":16120,"children":16121},{"style":264},[16122],{"type":30,"value":1075},{"type":20,"tag":194,"props":16124,"children":16125},{"class":196,"line":225},[16126],{"type":20,"tag":194,"props":16127,"children":16128},{"style":264},[16129],{"type":30,"value":16130},"    dataType:arraybuffer\n",{"type":20,"tag":194,"props":16132,"children":16133},{"class":196,"line":234},[16134,16138,16142,16146,16150,16154,16158],{"type":20,"tag":194,"props":16135,"children":16136},{"style":264},[16137],{"type":30,"value":4491},{"type":20,"tag":194,"props":16139,"children":16140},{"style":258},[16141],{"type":30,"value":572},{"type":20,"tag":194,"props":16143,"children":16144},{"style":264},[16145],{"type":30,"value":403},{"type":20,"tag":194,"props":16147,"children":16148},{"style":252},[16149],{"type":30,"value":393},{"type":20,"tag":194,"props":16151,"children":16152},{"style":264},[16153],{"type":30,"value":403},{"type":20,"tag":194,"props":16155,"children":16156},{"style":406},[16157],{"type":30,"value":6424},{"type":20,"tag":194,"props":16159,"children":16160},{"style":264},[16161],{"type":30,"value":4253},{"type":20,"tag":194,"props":16163,"children":16164},{"class":196,"line":243},[16165],{"type":20,"tag":194,"props":16166,"children":16167},{"style":201},[16168],{"type":30,"value":16169},"    // alter the result in someway and return it\n",{"type":20,"tag":194,"props":16171,"children":16172},{"class":196,"line":275},[16173,16177],{"type":20,"tag":194,"props":16174,"children":16175},{"style":252},[16176],{"type":30,"value":850},{"type":20,"tag":194,"props":16178,"children":16179},{"style":264},[16180],{"type":30,"value":16181}," res;\n",{"type":20,"tag":194,"props":16183,"children":16184},{"class":196,"line":284},[16185,16189,16193,16197,16201,16205,16209],{"type":20,"tag":194,"props":16186,"children":16187},{"style":264},[16188],{"type":30,"value":4491},{"type":20,"tag":194,"props":16190,"children":16191},{"style":258},[16192],{"type":30,"value":4496},{"type":20,"tag":194,"props":16194,"children":16195},{"style":264},[16196],{"type":30,"value":403},{"type":20,"tag":194,"props":16198,"children":16199},{"style":252},[16200],{"type":30,"value":393},{"type":20,"tag":194,"props":16202,"children":16203},{"style":264},[16204],{"type":30,"value":403},{"type":20,"tag":194,"props":16206,"children":16207},{"style":406},[16208],{"type":30,"value":6424},{"type":20,"tag":194,"props":16210,"children":16211},{"style":264},[16212],{"type":30,"value":4253},{"type":20,"tag":194,"props":16214,"children":16215},{"class":196,"line":311},[16216],{"type":20,"tag":194,"props":16217,"children":16218},{"style":201},[16219],{"type":30,"value":16220},"    // Do something with the result which was altered in the then block.\n",{"type":20,"tag":194,"props":16222,"children":16223},{"class":196,"line":320},[16224],{"type":20,"tag":194,"props":16225,"children":16226},{"style":264},[16227],{"type":30,"value":4204},{"type":20,"tag":15407,"props":16229,"children":16230},{},[],{"type":20,"tag":5510,"props":16232,"children":16234},{"id":16233},"native-comparison",[16235],{"type":30,"value":16236},"Native Comparison:",{"type":20,"tag":21,"props":16238,"children":16239},{},[16240,16241,16247],{"type":30,"value":16055},{"type":20,"tag":25,"props":16242,"children":16244},{"href":4821,"rel":16243},[50],[16245],{"type":30,"value":16246},"MDN Promise article",{"type":30,"value":16248},"for the current form of the Promise API.",{"type":20,"tag":35,"props":16250,"children":16252},{"id":16251},"constructor",[16253],{"type":30,"value":16254},"Constructor",{"type":20,"tag":8908,"props":16256,"children":16258},{"id":16257},"native",[16259],{"type":30,"value":16260},"Native",{"type":20,"tag":184,"props":16262,"children":16264},{"className":186,"code":16263,"language":188,"meta":8,"style":8},"var promise = new Promise(function(resolve, reject){});\n",[16265],{"type":20,"tag":68,"props":16266,"children":16267},{"__ignoreMap":8},[16268],{"type":20,"tag":194,"props":16269,"children":16270},{"class":196,"line":197},[16271,16275,16280,16284,16288,16292,16296,16300,16304,16308,16312,16316],{"type":20,"tag":194,"props":16272,"children":16273},{"style":252},[16274],{"type":30,"value":4057},{"type":20,"tag":194,"props":16276,"children":16277},{"style":264},[16278],{"type":30,"value":16279}," promise ",{"type":20,"tag":194,"props":16281,"children":16282},{"style":252},[16283],{"type":30,"value":461},{"type":20,"tag":194,"props":16285,"children":16286},{"style":252},[16287],{"type":30,"value":1031},{"type":20,"tag":194,"props":16289,"children":16290},{"style":680},[16291],{"type":30,"value":1159},{"type":20,"tag":194,"props":16293,"children":16294},{"style":264},[16295],{"type":30,"value":403},{"type":20,"tag":194,"props":16297,"children":16298},{"style":252},[16299],{"type":30,"value":393},{"type":20,"tag":194,"props":16301,"children":16302},{"style":264},[16303],{"type":30,"value":403},{"type":20,"tag":194,"props":16305,"children":16306},{"style":406},[16307],{"type":30,"value":1177},{"type":20,"tag":194,"props":16309,"children":16310},{"style":264},[16311],{"type":30,"value":414},{"type":20,"tag":194,"props":16313,"children":16314},{"style":406},[16315],{"type":30,"value":1186},{"type":20,"tag":194,"props":16317,"children":16318},{"style":264},[16319],{"type":30,"value":16320},"){});\n",{"type":20,"tag":8908,"props":16322,"children":16324},{"id":16323},"defer-1",[16325],{"type":30,"value":15314},{"type":20,"tag":184,"props":16327,"children":16329},{"className":186,"code":16328,"language":188,"meta":8,"style":8},"var promise = Defer();\n",[16330],{"type":20,"tag":68,"props":16331,"children":16332},{"__ignoreMap":8},[16333],{"type":20,"tag":194,"props":16334,"children":16335},{"class":196,"line":197},[16336,16340,16344,16348,16352],{"type":20,"tag":194,"props":16337,"children":16338},{"style":252},[16339],{"type":30,"value":4057},{"type":20,"tag":194,"props":16341,"children":16342},{"style":264},[16343],{"type":30,"value":16279},{"type":20,"tag":194,"props":16345,"children":16346},{"style":252},[16347],{"type":30,"value":461},{"type":20,"tag":194,"props":16349,"children":16350},{"style":258},[16351],{"type":30,"value":15442},{"type":20,"tag":194,"props":16353,"children":16354},{"style":264},[16355],{"type":30,"value":539},{"type":20,"tag":35,"props":16357,"children":16359},{"id":16358},"resolve-or-reject",[16360],{"type":30,"value":16361},"Resolve or Reject",{"type":20,"tag":8908,"props":16363,"children":16365},{"id":16364},"native-1",[16366],{"type":30,"value":16260},{"type":20,"tag":21,"props":16368,"children":16369},{},[16370],{"type":30,"value":16371},"Must be done within the Promise constructor.",{"type":20,"tag":8908,"props":16373,"children":16375},{"id":16374},"defer-2",[16376],{"type":30,"value":15314},{"type":20,"tag":21,"props":16378,"children":16379},{},[16380,16382,16388,16389,16395],{"type":30,"value":16381},"Can be done anywhere the variable in question is in scope, via ",{"type":20,"tag":68,"props":16383,"children":16385},{"className":16384},[],[16386],{"type":30,"value":16387},".resolve()",{"type":30,"value":88},{"type":20,"tag":68,"props":16390,"children":16392},{"className":16391},[],[16393],{"type":30,"value":16394},".reject()",{"type":30,"value":55},{"type":20,"tag":35,"props":16397,"children":16399},{"id":16398},"adding-successfailure-handlers",[16400],{"type":30,"value":16401},"Adding success/failure handlers",{"type":20,"tag":8908,"props":16403,"children":16405},{"id":16404},"native-2",[16406],{"type":30,"value":16260},{"type":20,"tag":184,"props":16408,"children":16410},{"className":186,"code":16409,"language":188,"meta":8,"style":8},"promise.then(successHandler, optionalFailureHandler);\npromise.catch(failureHandler);\n",[16411],{"type":20,"tag":68,"props":16412,"children":16413},{"__ignoreMap":8},[16414,16431],{"type":20,"tag":194,"props":16415,"children":16416},{"class":196,"line":197},[16417,16422,16426],{"type":20,"tag":194,"props":16418,"children":16419},{"style":264},[16420],{"type":30,"value":16421},"promise.",{"type":20,"tag":194,"props":16423,"children":16424},{"style":258},[16425],{"type":30,"value":572},{"type":20,"tag":194,"props":16427,"children":16428},{"style":264},[16429],{"type":30,"value":16430},"(successHandler, optionalFailureHandler);\n",{"type":20,"tag":194,"props":16432,"children":16433},{"class":196,"line":207},[16434,16438,16442],{"type":20,"tag":194,"props":16435,"children":16436},{"style":264},[16437],{"type":30,"value":16421},{"type":20,"tag":194,"props":16439,"children":16440},{"style":258},[16441],{"type":30,"value":754},{"type":20,"tag":194,"props":16443,"children":16444},{"style":264},[16445],{"type":30,"value":16446},"(failureHandler);\n",{"type":20,"tag":8908,"props":16448,"children":16450},{"id":16449},"defer-3",[16451],{"type":30,"value":15314},{"type":20,"tag":184,"props":16453,"children":16455},{"className":186,"code":16454,"language":188,"meta":8,"style":8},"promise.then(successHandler, optionalFailureHandler);\npromise.fail(failureHandler);\npromise.done(doneHandler); // Called when the promise chain fully resolves - not present in native Promise\npromise.always(alwaysHandler); // Called when the promise chain fully resolves, or is rejected - not present in native Promise\n",[16456],{"type":20,"tag":68,"props":16457,"children":16458},{"__ignoreMap":8},[16459,16474,16489,16510],{"type":20,"tag":194,"props":16460,"children":16461},{"class":196,"line":197},[16462,16466,16470],{"type":20,"tag":194,"props":16463,"children":16464},{"style":264},[16465],{"type":30,"value":16421},{"type":20,"tag":194,"props":16467,"children":16468},{"style":258},[16469],{"type":30,"value":572},{"type":20,"tag":194,"props":16471,"children":16472},{"style":264},[16473],{"type":30,"value":16430},{"type":20,"tag":194,"props":16475,"children":16476},{"class":196,"line":207},[16477,16481,16485],{"type":20,"tag":194,"props":16478,"children":16479},{"style":264},[16480],{"type":30,"value":16421},{"type":20,"tag":194,"props":16482,"children":16483},{"style":258},[16484],{"type":30,"value":4546},{"type":20,"tag":194,"props":16486,"children":16487},{"style":264},[16488],{"type":30,"value":16446},{"type":20,"tag":194,"props":16490,"children":16491},{"class":196,"line":216},[16492,16496,16500,16505],{"type":20,"tag":194,"props":16493,"children":16494},{"style":264},[16495],{"type":30,"value":16421},{"type":20,"tag":194,"props":16497,"children":16498},{"style":258},[16499],{"type":30,"value":4496},{"type":20,"tag":194,"props":16501,"children":16502},{"style":264},[16503],{"type":30,"value":16504},"(doneHandler); ",{"type":20,"tag":194,"props":16506,"children":16507},{"style":201},[16508],{"type":30,"value":16509},"// Called when the promise chain fully resolves - not present in native Promise\n",{"type":20,"tag":194,"props":16511,"children":16512},{"class":196,"line":225},[16513,16517,16522,16527],{"type":20,"tag":194,"props":16514,"children":16515},{"style":264},[16516],{"type":30,"value":16421},{"type":20,"tag":194,"props":16518,"children":16519},{"style":258},[16520],{"type":30,"value":16521},"always",{"type":20,"tag":194,"props":16523,"children":16524},{"style":264},[16525],{"type":30,"value":16526},"(alwaysHandler); ",{"type":20,"tag":194,"props":16528,"children":16529},{"style":201},[16530],{"type":30,"value":16531},"// Called when the promise chain fully resolves, or is rejected - not present in native Promise\n",{"type":20,"tag":15407,"props":16533,"children":16534},{},[],{"type":20,"tag":5510,"props":16536,"children":16538},{"id":16537},"jquery-comparison",[16539],{"type":30,"value":16540},"jQuery Comparison:",{"type":20,"tag":21,"props":16542,"children":16543},{},[16544,16545,16551],{"type":30,"value":16055},{"type":20,"tag":25,"props":16546,"children":16548},{"href":15279,"rel":16547},[50],[16549],{"type":30,"value":16550},"jQuery Deferred documentation",{"type":30,"value":16552}," for the full Deferred API.",{"type":20,"tag":35,"props":16554,"children":16556},{"id":16555},"adding-handlers",[16557],{"type":30,"value":16558},"Adding handlers",{"type":20,"tag":21,"props":16560,"children":16561},{},[16562],{"type":30,"value":16563},"jQuery allows you to add an array of handlers, or a comma-seperated series of handlers, for most calls. Defer does not, for purely personal, aesthetic-preference reasons. If you want to add multiple handlers, make multiple calls to .done, .then, etc.",{"type":20,"tag":35,"props":16565,"children":16567},{"id":16566},"when-and-race",[16568],{"type":30,"value":16569},"When and race",{"type":20,"tag":8908,"props":16571,"children":16572},{"id":14},[16573],{"type":30,"value":4412},{"type":20,"tag":184,"props":16575,"children":16577},{"className":186,"code":16576,"language":188,"meta":8,"style":8},"jQuery.when(comma, separated, deferreds).done(function(valuesArray){});\n",[16578],{"type":20,"tag":68,"props":16579,"children":16580},{"__ignoreMap":8},[16581],{"type":20,"tag":194,"props":16582,"children":16583},{"class":196,"line":197},[16584,16589,16594,16599,16603,16607,16611,16615,16620],{"type":20,"tag":194,"props":16585,"children":16586},{"style":264},[16587],{"type":30,"value":16588},"jQuery.",{"type":20,"tag":194,"props":16590,"children":16591},{"style":258},[16592],{"type":30,"value":16593},"when",{"type":20,"tag":194,"props":16595,"children":16596},{"style":264},[16597],{"type":30,"value":16598},"(comma, separated, deferreds).",{"type":20,"tag":194,"props":16600,"children":16601},{"style":258},[16602],{"type":30,"value":4496},{"type":20,"tag":194,"props":16604,"children":16605},{"style":264},[16606],{"type":30,"value":403},{"type":20,"tag":194,"props":16608,"children":16609},{"style":252},[16610],{"type":30,"value":393},{"type":20,"tag":194,"props":16612,"children":16613},{"style":264},[16614],{"type":30,"value":403},{"type":20,"tag":194,"props":16616,"children":16617},{"style":406},[16618],{"type":30,"value":16619},"valuesArray",{"type":20,"tag":194,"props":16621,"children":16622},{"style":264},[16623],{"type":30,"value":16320},{"type":20,"tag":8908,"props":16625,"children":16627},{"id":16626},"defer-4",[16628],{"type":30,"value":15314},{"type":20,"tag":184,"props":16630,"children":16632},{"className":186,"code":16631,"language":188,"meta":8,"style":8},"Promise.all([array, of, Defer, Objects]).then(function(valuesArray){});\nPromise.race([array, of, Defer, Objects]).then(function(firstDeferToResolveValue){});\n",[16633],{"type":20,"tag":68,"props":16634,"children":16635},{"__ignoreMap":8},[16636,16690],{"type":20,"tag":194,"props":16637,"children":16638},{"class":196,"line":197},[16639,16643,16647,16651,16656,16661,16666,16670,16674,16678,16682,16686],{"type":20,"tag":194,"props":16640,"children":16641},{"style":680},[16642],{"type":30,"value":15974},{"type":20,"tag":194,"props":16644,"children":16645},{"style":264},[16646],{"type":30,"value":55},{"type":20,"tag":194,"props":16648,"children":16649},{"style":258},[16650],{"type":30,"value":15983},{"type":20,"tag":194,"props":16652,"children":16653},{"style":264},[16654],{"type":30,"value":16655},"([array, ",{"type":20,"tag":194,"props":16657,"children":16658},{"style":252},[16659],{"type":30,"value":16660},"of",{"type":20,"tag":194,"props":16662,"children":16663},{"style":264},[16664],{"type":30,"value":16665},", Defer, Objects]).",{"type":20,"tag":194,"props":16667,"children":16668},{"style":258},[16669],{"type":30,"value":572},{"type":20,"tag":194,"props":16671,"children":16672},{"style":264},[16673],{"type":30,"value":403},{"type":20,"tag":194,"props":16675,"children":16676},{"style":252},[16677],{"type":30,"value":393},{"type":20,"tag":194,"props":16679,"children":16680},{"style":264},[16681],{"type":30,"value":403},{"type":20,"tag":194,"props":16683,"children":16684},{"style":406},[16685],{"type":30,"value":16619},{"type":20,"tag":194,"props":16687,"children":16688},{"style":264},[16689],{"type":30,"value":16320},{"type":20,"tag":194,"props":16691,"children":16692},{"class":196,"line":207},[16693,16697,16701,16706,16710,16714,16718,16722,16726,16730,16734,16739],{"type":20,"tag":194,"props":16694,"children":16695},{"style":680},[16696],{"type":30,"value":15974},{"type":20,"tag":194,"props":16698,"children":16699},{"style":264},[16700],{"type":30,"value":55},{"type":20,"tag":194,"props":16702,"children":16703},{"style":258},[16704],{"type":30,"value":16705},"race",{"type":20,"tag":194,"props":16707,"children":16708},{"style":264},[16709],{"type":30,"value":16655},{"type":20,"tag":194,"props":16711,"children":16712},{"style":252},[16713],{"type":30,"value":16660},{"type":20,"tag":194,"props":16715,"children":16716},{"style":264},[16717],{"type":30,"value":16665},{"type":20,"tag":194,"props":16719,"children":16720},{"style":258},[16721],{"type":30,"value":572},{"type":20,"tag":194,"props":16723,"children":16724},{"style":264},[16725],{"type":30,"value":403},{"type":20,"tag":194,"props":16727,"children":16728},{"style":252},[16729],{"type":30,"value":393},{"type":20,"tag":194,"props":16731,"children":16732},{"style":264},[16733],{"type":30,"value":403},{"type":20,"tag":194,"props":16735,"children":16736},{"style":406},[16737],{"type":30,"value":16738},"firstDeferToResolveValue",{"type":20,"tag":194,"props":16740,"children":16741},{"style":264},[16742],{"type":30,"value":16320},{"type":20,"tag":15407,"props":16744,"children":16745},{},[],{"type":20,"tag":5510,"props":16747,"children":16748},{"id":5321},[16749],{"type":30,"value":5324},{"type":20,"tag":5326,"props":16751,"children":16752},{},[16753,16764,16776,16788,16799,16811],{"type":20,"tag":5330,"props":16754,"children":16755},{},[16756,16762],{"type":20,"tag":25,"props":16757,"children":16759},{"href":15251,"rel":16758},[50],[16760],{"type":30,"value":16761},"Promises/A+",{"type":30,"value":16763}," - The Promises spec.",{"type":20,"tag":5330,"props":16765,"children":16766},{},[16767,16774],{"type":20,"tag":25,"props":16768,"children":16771},{"href":16769,"rel":16770},"http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects",[50],[16772],{"type":30,"value":16773},"Es6 Promise Draft",{"type":30,"value":16775}," - The draft of the promise spec being implemented by browsers.",{"type":20,"tag":5330,"props":16777,"children":16778},{},[16779,16786],{"type":20,"tag":25,"props":16780,"children":16783},{"href":16781,"rel":16782},"https://github.com/kriskowal/q/wiki/Coming-from-jQuery",[50],[16784],{"type":30,"value":16785},"Coming from jQuery to Q",{"type":30,"value":16787}," - Discusses some of the differences between jQuery Deferred and a Promise/A+ compliant library.",{"type":20,"tag":5330,"props":16789,"children":16790},{},[16791,16797],{"type":20,"tag":25,"props":16792,"children":16794},{"href":15265,"rel":16793},[50],[16795],{"type":30,"value":16796},"MDN Promises",{"type":30,"value":16798}," - MDN reference on native Promises.",{"type":20,"tag":5330,"props":16800,"children":16801},{},[16802,16809],{"type":20,"tag":25,"props":16803,"children":16806},{"href":16804,"rel":16805},"http://www.html5rocks.com/en/tutorials/es6/promises/",[50],[16807],{"type":30,"value":16808},"HTML5rocks article",{"type":30,"value":16810}," - Article on 3s6 promises.",{"type":20,"tag":5330,"props":16812,"children":16813},{},[16814,16821],{"type":20,"tag":25,"props":16815,"children":16818},{"href":16816,"rel":16817},"http://www.mattgreer.org/articles/promises-in-wicked-detail/",[50],[16819],{"type":30,"value":16820},"Javascript Promises in Wicked Detail",{"type":30,"value":16822}," - Excellent article breaking down the what, if not the why, of promises.",{"type":20,"tag":3951,"props":16824,"children":16825},{},[16826],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":16828},[16829,16830,16833,16838,16852,16859],{"id":15208,"depth":207,"text":15211},{"id":15311,"depth":207,"text":15314,"children":16831},[16832],{"id":15317,"depth":216,"text":15320},{"id":15354,"depth":207,"text":15357,"children":16834},[16835,16836,16837],{"id":15412,"depth":216,"text":15415},{"id":15633,"depth":216,"text":15636},{"id":16047,"depth":216,"text":16050},{"id":16233,"depth":207,"text":16236,"children":16839},[16840,16844,16848],{"id":16251,"depth":216,"text":16254,"children":16841},[16842,16843],{"id":16257,"depth":225,"text":16260},{"id":16323,"depth":225,"text":15314},{"id":16358,"depth":216,"text":16361,"children":16845},[16846,16847],{"id":16364,"depth":225,"text":16260},{"id":16374,"depth":225,"text":15314},{"id":16398,"depth":216,"text":16401,"children":16849},[16850,16851],{"id":16404,"depth":225,"text":16260},{"id":16449,"depth":225,"text":15314},{"id":16537,"depth":207,"text":16540,"children":16853},[16854,16855],{"id":16555,"depth":216,"text":16558},{"id":16566,"depth":216,"text":16569,"children":16856},[16857,16858],{"id":14,"depth":225,"text":4412},{"id":16626,"depth":225,"text":15314},{"id":5321,"depth":207,"text":5324},"content:ckeefer:2014-7:promises.md","ckeefer/2014-7/promises.md","ckeefer/2014-7/promises",{"user":3970,"name":3971},{"_path":16865,"_dir":16866,"_draft":7,"_partial":7,"_locale":8,"title":16867,"description":16868,"publishDate":16869,"tags":16870,"excerpt":16868,"body":16872,"_type":3963,"_id":18416,"_source":3965,"_file":18417,"_stem":18418,"_extension":3968,"author":18419},"/ckeefer/2014-4/hidden-options","2014-4","Hidden Options: A Workaround","Here's the situation: You've got a select. Maybe a whole bunch of selects, with a ton of options each (metric ton - let's keep our imaginary hyperbolic units straight here); and these are meant to be complex interactive elements, with options made visible or not as some programmatic condition dictates.","2014-04-23",[16871,13,14],"how-to",{"type":17,"children":16873,"toc":18414},[16874,16878,16883,16896,16955,16960,16965,17009,17014,18220,18225,18280,18285,18346,18372,18386,18391,18405,18410],{"type":20,"tag":21,"props":16875,"children":16876},{},[16877],{"type":30,"value":16868},{"type":20,"tag":21,"props":16879,"children":16880},{},[16881],{"type":30,"value":16882},"Traditionally, if you wanted to selectively display options, you had to do it the hard way - remove the non-visible option nodes entirely. What, did you want to filter on some state information stored on the node? Too bad - you'll have to keep track of the full structure outside of the DOM and filter on that, inserting or removing elements as needed.",{"type":20,"tag":21,"props":16884,"children":16885},{},[16886,16888,16894],{"type":30,"value":16887},"This is sub-optimal. It's much tidier if we can just set ",{"type":20,"tag":68,"props":16889,"children":16891},{"className":16890},[],[16892],{"type":30,"value":16893},"display:none",{"type":30,"value":16895}," on our options elements, and have them hidden like any other DOM element:",{"type":20,"tag":184,"props":16897,"children":16901},{"className":16898,"code":16899,"language":16900,"meta":8,"style":8},"language-css shiki shiki-themes github-light github-dark","option[disabled]{\n    display:none;\n}\n","css",[16902],{"type":20,"tag":68,"props":16903,"children":16904},{"__ignoreMap":8},[16905,16927,16948],{"type":20,"tag":194,"props":16906,"children":16907},{"class":196,"line":197},[16908,16913,16917,16922],{"type":20,"tag":194,"props":16909,"children":16910},{"style":6650},[16911],{"type":30,"value":16912},"option",{"type":20,"tag":194,"props":16914,"children":16915},{"style":264},[16916],{"type":30,"value":12203},{"type":20,"tag":194,"props":16918,"children":16919},{"style":258},[16920],{"type":30,"value":16921},"disabled",{"type":20,"tag":194,"props":16923,"children":16924},{"style":264},[16925],{"type":30,"value":16926},"]{\n",{"type":20,"tag":194,"props":16928,"children":16929},{"class":196,"line":207},[16930,16935,16939,16944],{"type":20,"tag":194,"props":16931,"children":16932},{"style":680},[16933],{"type":30,"value":16934},"    display",{"type":20,"tag":194,"props":16936,"children":16937},{"style":264},[16938],{"type":30,"value":1554},{"type":20,"tag":194,"props":16940,"children":16941},{"style":680},[16942],{"type":30,"value":16943},"none",{"type":20,"tag":194,"props":16945,"children":16946},{"style":264},[16947],{"type":30,"value":1384},{"type":20,"tag":194,"props":16949,"children":16950},{"class":196,"line":216},[16951],{"type":20,"tag":194,"props":16952,"children":16953},{"style":264},[16954],{"type":30,"value":864},{"type":20,"tag":21,"props":16956,"children":16957},{},[16958],{"type":30,"value":16959},"and in most modern browsers (Firefox, IE9+, Safari), this works just fine. We can then filter in place on the elements, and selectively display them.",{"type":20,"tag":21,"props":16961,"children":16962},{},[16963],{"type":30,"value":16964},"Have you noticed the glaring omission yet? Yes, Chrome isn't among the browsers this works 'just fine' in.",{"type":20,"tag":21,"props":16966,"children":16967},{},[16968,16970,16975,16977,16982,16984,16991,16993,17000,17002,17007],{"type":30,"value":16969},"You ",{"type":20,"tag":4379,"props":16971,"children":16972},{},[16973],{"type":30,"value":16974},"can",{"type":30,"value":16976}," set ",{"type":20,"tag":68,"props":16978,"children":16980},{"className":16979},[],[16981],{"type":30,"value":16893},{"type":30,"value":16983}," on your disabled options to hide them, and that will work - but as ",{"type":20,"tag":25,"props":16985,"children":16988},{"href":16986,"rel":16987},"http://stackoverflow.com/questions/17203826/chrome-bug-on-select-element-dropdown-when-many-options-are-hidden",[50],[16989],{"type":30,"value":16990},"stackoverflow user JMack discovered",{"type":30,"value":16992},", and per ",{"type":20,"tag":25,"props":16994,"children":16997},{"href":16995,"rel":16996},"http://code.google.com/p/chromium/issues/detail?id=139595",[50],[16998],{"type":30,"value":16999},"this long-standing chromium bug",{"type":30,"value":17001}," (open since Jul 30 2012, with the most recent activity on it a ",{"type":20,"tag":5490,"props":17003,"children":17004},{},[17005],{"type":30,"value":17006},"downgrade",{"type":30,"value":17008}," in priority), when you have hidden options in your select, the select dropdown will fail to resize itself appropriately - to the point that the dropdown may not show anything beyond the initial visible option, with the rest of the visible options hidden beneath. They're still selectable, and can be scrolled to, but the dropdown list will be tiny and scrolling won't work quite right, often leaving you with the top and bottom of the next two options visible.",{"type":20,"tag":21,"props":17010,"children":17011},{},[17012],{"type":30,"value":17013},"We're not here to complain, though - we're here to get things done. Let's whip up a workaround, and then discuss how to use it, how and why it works.",{"type":20,"tag":184,"props":17015,"children":17017},{"className":186,"code":17016,"language":188,"meta":8,"style":8},"(function($){\n    var userAgent = window.navigator.userAgent,\n        needsWrap = (userAgent.indexOf('Trident') !== -1 || userAgent.indexOf('AppleWebKit') !== -1);\n    /**\n     * Workaround for browsers that respect hidden options elements, but then fail to resize the select dropdown\n     * to display any visible elements beyond those that appear before any hidden elements - namely, Chrome.\n     * Based on the filter function, we either select all options that match (or, if invert is true, all that\n     * don't match), set them to disabled (with the expectation that there's a css rule hiding disabled options\n     * somewhere), and then pull the disabled options out of the DOM and insert them back in at the end of the\n     * select - this is tested as working in the most recent version of Chrome (as of this writing, v34).\n     * See also http://code.google.com/p/chromium/issues/detail?id=139595 and\n     * http://stackoverflow.com/questions/17203826/chrome-bug-on-select-element-dropdown-when-many-options-are-hidden\n     * for reports of the browser bug this works around.\n     *\n     * Additionally, we handle browsers that DON'T respect hidden options, by agent-sniffing such browsers\n     * and wrapping and unwrapping as necessary options that we want hidden in a span tag.\n     *\n     * @note This works, but DOM manipulation in IE is SLOW - much slower to perform an appendChild operation\n     * than any of the other major browsers. Wrapping/unwrapping large sets of options will take a relative long time (>2s)\n     * and have the potential to hang the UI thread.\n     * @param {string|HtmlElement|jQuery} el\n     * @param {function} filter\n     * @param {boolean=} invert\n     * @returns {jQuery}\n     */\n    $.elideOptions = function(el, filter, invert){\n        var $el = (el instanceof $) ? el : $(el);\n\n        $el.each(function(){\n            if (this.tagName !== 'SELECT') return;\n            var $this = $(this),\n                opts = $this.find('option').prop('disabled', false),\n                spans;\n\n            // Unwrap all options from their span tags\n            if (needsWrap && (spans = $this.find('span')) && spans.length){\n                spans.children().unwrap();\n            }\n\n            opts = (invert) ? opts.not(filter).prop('disabled', true) :\n                opts.filter(filter).prop('disabled', true);\n\n            // Wrap options in a single hidden span to hide them on browsers that don't support\n            // display:none for options\n            if (needsWrap) {\n                opts.wrapAll('\u003Cspan class=\"hide\">\u003C/span>');\n                opts = opts.parent('span');\n            }\n\n            opts.detach().appendTo($this);\n        });\n\n        return $el;\n    };\n\n    /**\n     * Allow for the $(element) form of invocation.\n     * @param {function} filter\n     * @param {boolean=} invert\n     * @returns {jQuery}\n     */\n    $.fn.elideOptions = function(filter, invert){\n        return $.elideOptions(this, filter, invert);\n    };\n})(jQuery);\n",[17018],{"type":20,"tag":68,"props":17019,"children":17020},{"__ignoreMap":8},[17021,17044,17065,17156,17163,17171,17179,17187,17195,17203,17211,17219,17227,17235,17242,17250,17258,17265,17282,17290,17298,17319,17340,17361,17377,17384,17435,17492,17499,17524,17565,17597,17658,17666,17673,17681,17746,17772,17779,17786,17849,17889,17896,17904,17912,17924,17949,17981,17988,17995,18022,18029,18036,18048,18055,18062,18069,18077,18096,18115,18130,18137,18177,18205,18212],{"type":20,"tag":194,"props":17022,"children":17023},{"class":196,"line":197},[17024,17028,17032,17036,17040],{"type":20,"tag":194,"props":17025,"children":17026},{"style":264},[17027],{"type":30,"value":403},{"type":20,"tag":194,"props":17029,"children":17030},{"style":252},[17031],{"type":30,"value":393},{"type":20,"tag":194,"props":17033,"children":17034},{"style":264},[17035],{"type":30,"value":403},{"type":20,"tag":194,"props":17037,"children":17038},{"style":406},[17039],{"type":30,"value":6468},{"type":20,"tag":194,"props":17041,"children":17042},{"style":264},[17043],{"type":30,"value":4253},{"type":20,"tag":194,"props":17045,"children":17046},{"class":196,"line":207},[17047,17051,17056,17060],{"type":20,"tag":194,"props":17048,"children":17049},{"style":252},[17050],{"type":30,"value":451},{"type":20,"tag":194,"props":17052,"children":17053},{"style":264},[17054],{"type":30,"value":17055}," userAgent ",{"type":20,"tag":194,"props":17057,"children":17058},{"style":252},[17059],{"type":30,"value":461},{"type":20,"tag":194,"props":17061,"children":17062},{"style":264},[17063],{"type":30,"value":17064}," window.navigator.userAgent,\n",{"type":20,"tag":194,"props":17066,"children":17067},{"class":196,"line":216},[17068,17073,17077,17082,17087,17091,17096,17100,17105,17110,17114,17118,17123,17127,17131,17136,17140,17144,17148,17152],{"type":20,"tag":194,"props":17069,"children":17070},{"style":264},[17071],{"type":30,"value":17072},"        needsWrap ",{"type":20,"tag":194,"props":17074,"children":17075},{"style":252},[17076],{"type":30,"value":461},{"type":20,"tag":194,"props":17078,"children":17079},{"style":264},[17080],{"type":30,"value":17081}," (userAgent.",{"type":20,"tag":194,"props":17083,"children":17084},{"style":258},[17085],{"type":30,"value":17086},"indexOf",{"type":20,"tag":194,"props":17088,"children":17089},{"style":264},[17090],{"type":30,"value":403},{"type":20,"tag":194,"props":17092,"children":17093},{"style":506},[17094],{"type":30,"value":17095},"'Trident'",{"type":20,"tag":194,"props":17097,"children":17098},{"style":264},[17099],{"type":30,"value":514},{"type":20,"tag":194,"props":17101,"children":17102},{"style":252},[17103],{"type":30,"value":17104},"!==",{"type":20,"tag":194,"props":17106,"children":17107},{"style":252},[17108],{"type":30,"value":17109}," -",{"type":20,"tag":194,"props":17111,"children":17112},{"style":680},[17113],{"type":30,"value":9401},{"type":20,"tag":194,"props":17115,"children":17116},{"style":252},[17117],{"type":30,"value":5181},{"type":20,"tag":194,"props":17119,"children":17120},{"style":264},[17121],{"type":30,"value":17122}," userAgent.",{"type":20,"tag":194,"props":17124,"children":17125},{"style":258},[17126],{"type":30,"value":17086},{"type":20,"tag":194,"props":17128,"children":17129},{"style":264},[17130],{"type":30,"value":403},{"type":20,"tag":194,"props":17132,"children":17133},{"style":506},[17134],{"type":30,"value":17135},"'AppleWebKit'",{"type":20,"tag":194,"props":17137,"children":17138},{"style":264},[17139],{"type":30,"value":514},{"type":20,"tag":194,"props":17141,"children":17142},{"style":252},[17143],{"type":30,"value":17104},{"type":20,"tag":194,"props":17145,"children":17146},{"style":252},[17147],{"type":30,"value":17109},{"type":20,"tag":194,"props":17149,"children":17150},{"style":680},[17151],{"type":30,"value":9401},{"type":20,"tag":194,"props":17153,"children":17154},{"style":264},[17155],{"type":30,"value":1649},{"type":20,"tag":194,"props":17157,"children":17158},{"class":196,"line":225},[17159],{"type":20,"tag":194,"props":17160,"children":17161},{"style":201},[17162],{"type":30,"value":1399},{"type":20,"tag":194,"props":17164,"children":17165},{"class":196,"line":234},[17166],{"type":20,"tag":194,"props":17167,"children":17168},{"style":201},[17169],{"type":30,"value":17170},"     * Workaround for browsers that respect hidden options elements, but then fail to resize the select dropdown\n",{"type":20,"tag":194,"props":17172,"children":17173},{"class":196,"line":243},[17174],{"type":20,"tag":194,"props":17175,"children":17176},{"style":201},[17177],{"type":30,"value":17178},"     * to display any visible elements beyond those that appear before any hidden elements - namely, Chrome.\n",{"type":20,"tag":194,"props":17180,"children":17181},{"class":196,"line":275},[17182],{"type":20,"tag":194,"props":17183,"children":17184},{"style":201},[17185],{"type":30,"value":17186},"     * Based on the filter function, we either select all options that match (or, if invert is true, all that\n",{"type":20,"tag":194,"props":17188,"children":17189},{"class":196,"line":284},[17190],{"type":20,"tag":194,"props":17191,"children":17192},{"style":201},[17193],{"type":30,"value":17194},"     * don't match), set them to disabled (with the expectation that there's a css rule hiding disabled options\n",{"type":20,"tag":194,"props":17196,"children":17197},{"class":196,"line":311},[17198],{"type":20,"tag":194,"props":17199,"children":17200},{"style":201},[17201],{"type":30,"value":17202},"     * somewhere), and then pull the disabled options out of the DOM and insert them back in at the end of the\n",{"type":20,"tag":194,"props":17204,"children":17205},{"class":196,"line":320},[17206],{"type":20,"tag":194,"props":17207,"children":17208},{"style":201},[17209],{"type":30,"value":17210},"     * select - this is tested as working in the most recent version of Chrome (as of this writing, v34).\n",{"type":20,"tag":194,"props":17212,"children":17213},{"class":196,"line":347},[17214],{"type":20,"tag":194,"props":17215,"children":17216},{"style":201},[17217],{"type":30,"value":17218},"     * See also http://code.google.com/p/chromium/issues/detail?id=139595 and\n",{"type":20,"tag":194,"props":17220,"children":17221},{"class":196,"line":356},[17222],{"type":20,"tag":194,"props":17223,"children":17224},{"style":201},[17225],{"type":30,"value":17226},"     * http://stackoverflow.com/questions/17203826/chrome-bug-on-select-element-dropdown-when-many-options-are-hidden\n",{"type":20,"tag":194,"props":17228,"children":17229},{"class":196,"line":378},[17230],{"type":20,"tag":194,"props":17231,"children":17232},{"style":201},[17233],{"type":30,"value":17234},"     * for reports of the browser bug this works around.\n",{"type":20,"tag":194,"props":17236,"children":17237},{"class":196,"line":387},[17238],{"type":20,"tag":194,"props":17239,"children":17240},{"style":201},[17241],{"type":30,"value":1423},{"type":20,"tag":194,"props":17243,"children":17244},{"class":196,"line":445},[17245],{"type":20,"tag":194,"props":17246,"children":17247},{"style":201},[17248],{"type":30,"value":17249},"     * Additionally, we handle browsers that DON'T respect hidden options, by agent-sniffing such browsers\n",{"type":20,"tag":194,"props":17251,"children":17252},{"class":196,"line":479},[17253],{"type":20,"tag":194,"props":17254,"children":17255},{"style":201},[17256],{"type":30,"value":17257},"     * and wrapping and unwrapping as necessary options that we want hidden in a span tag.\n",{"type":20,"tag":194,"props":17259,"children":17260},{"class":196,"line":542},[17261],{"type":20,"tag":194,"props":17262,"children":17263},{"style":201},[17264],{"type":30,"value":1423},{"type":20,"tag":194,"props":17266,"children":17267},{"class":196,"line":552},[17268,17272,17277],{"type":20,"tag":194,"props":17269,"children":17270},{"style":201},[17271],{"type":30,"value":1431},{"type":20,"tag":194,"props":17273,"children":17274},{"style":252},[17275],{"type":30,"value":17276},"@note",{"type":20,"tag":194,"props":17278,"children":17279},{"style":201},[17280],{"type":30,"value":17281}," This works, but DOM manipulation in IE is SLOW - much slower to perform an appendChild operation\n",{"type":20,"tag":194,"props":17283,"children":17284},{"class":196,"line":598},[17285],{"type":20,"tag":194,"props":17286,"children":17287},{"style":201},[17288],{"type":30,"value":17289},"     * than any of the other major browsers. Wrapping/unwrapping large sets of options will take a relative long time (>2s)\n",{"type":20,"tag":194,"props":17291,"children":17292},{"class":196,"line":611},[17293],{"type":20,"tag":194,"props":17294,"children":17295},{"style":201},[17296],{"type":30,"value":17297},"     * and have the potential to hang the UI thread.\n",{"type":20,"tag":194,"props":17299,"children":17300},{"class":196,"line":630},[17301,17305,17309,17314],{"type":20,"tag":194,"props":17302,"children":17303},{"style":201},[17304],{"type":30,"value":1431},{"type":20,"tag":194,"props":17306,"children":17307},{"style":252},[17308],{"type":30,"value":255},{"type":20,"tag":194,"props":17310,"children":17311},{"style":258},[17312],{"type":30,"value":17313}," {string|HtmlElement|jQuery}",{"type":20,"tag":194,"props":17315,"children":17316},{"style":264},[17317],{"type":30,"value":17318}," el\n",{"type":20,"tag":194,"props":17320,"children":17321},{"class":196,"line":713},[17322,17326,17330,17335],{"type":20,"tag":194,"props":17323,"children":17324},{"style":201},[17325],{"type":30,"value":1431},{"type":20,"tag":194,"props":17327,"children":17328},{"style":252},[17329],{"type":30,"value":255},{"type":20,"tag":194,"props":17331,"children":17332},{"style":258},[17333],{"type":30,"value":17334}," {function}",{"type":20,"tag":194,"props":17336,"children":17337},{"style":264},[17338],{"type":30,"value":17339}," filter\n",{"type":20,"tag":194,"props":17341,"children":17342},{"class":196,"line":743},[17343,17347,17351,17356],{"type":20,"tag":194,"props":17344,"children":17345},{"style":201},[17346],{"type":30,"value":1431},{"type":20,"tag":194,"props":17348,"children":17349},{"style":252},[17350],{"type":30,"value":255},{"type":20,"tag":194,"props":17352,"children":17353},{"style":258},[17354],{"type":30,"value":17355}," {boolean=}",{"type":20,"tag":194,"props":17357,"children":17358},{"style":264},[17359],{"type":30,"value":17360}," invert\n",{"type":20,"tag":194,"props":17362,"children":17363},{"class":196,"line":762},[17364,17368,17372],{"type":20,"tag":194,"props":17365,"children":17366},{"style":201},[17367],{"type":30,"value":1431},{"type":20,"tag":194,"props":17369,"children":17370},{"style":252},[17371],{"type":30,"value":964},{"type":20,"tag":194,"props":17373,"children":17374},{"style":258},[17375],{"type":30,"value":17376}," {jQuery}\n",{"type":20,"tag":194,"props":17378,"children":17379},{"class":196,"line":771},[17380],{"type":20,"tag":194,"props":17381,"children":17382},{"style":201},[17383],{"type":30,"value":1448},{"type":20,"tag":194,"props":17385,"children":17386},{"class":196,"line":785},[17387,17391,17396,17400,17404,17408,17413,17417,17422,17426,17431],{"type":20,"tag":194,"props":17388,"children":17389},{"style":264},[17390],{"type":30,"value":13352},{"type":20,"tag":194,"props":17392,"children":17393},{"style":258},[17394],{"type":30,"value":17395},"elideOptions",{"type":20,"tag":194,"props":17397,"children":17398},{"style":252},[17399],{"type":30,"value":3298},{"type":20,"tag":194,"props":17401,"children":17402},{"style":252},[17403],{"type":30,"value":3303},{"type":20,"tag":194,"props":17405,"children":17406},{"style":264},[17407],{"type":30,"value":403},{"type":20,"tag":194,"props":17409,"children":17410},{"style":406},[17411],{"type":30,"value":17412},"el",{"type":20,"tag":194,"props":17414,"children":17415},{"style":264},[17416],{"type":30,"value":414},{"type":20,"tag":194,"props":17418,"children":17419},{"style":406},[17420],{"type":30,"value":17421},"filter",{"type":20,"tag":194,"props":17423,"children":17424},{"style":264},[17425],{"type":30,"value":414},{"type":20,"tag":194,"props":17427,"children":17428},{"style":406},[17429],{"type":30,"value":17430},"invert",{"type":20,"tag":194,"props":17432,"children":17433},{"style":264},[17434],{"type":30,"value":4253},{"type":20,"tag":194,"props":17436,"children":17437},{"class":196,"line":818},[17438,17442,17447,17451,17456,17461,17466,17470,17474,17479,17483,17487],{"type":20,"tag":194,"props":17439,"children":17440},{"style":252},[17441],{"type":30,"value":1491},{"type":20,"tag":194,"props":17443,"children":17444},{"style":264},[17445],{"type":30,"value":17446}," $el ",{"type":20,"tag":194,"props":17448,"children":17449},{"style":252},[17450],{"type":30,"value":461},{"type":20,"tag":194,"props":17452,"children":17453},{"style":264},[17454],{"type":30,"value":17455}," (el ",{"type":20,"tag":194,"props":17457,"children":17458},{"style":252},[17459],{"type":30,"value":17460},"instanceof",{"type":20,"tag":194,"props":17462,"children":17463},{"style":258},[17464],{"type":30,"value":17465}," $",{"type":20,"tag":194,"props":17467,"children":17468},{"style":264},[17469],{"type":30,"value":514},{"type":20,"tag":194,"props":17471,"children":17472},{"style":252},[17473],{"type":30,"value":1544},{"type":20,"tag":194,"props":17475,"children":17476},{"style":264},[17477],{"type":30,"value":17478}," el ",{"type":20,"tag":194,"props":17480,"children":17481},{"style":252},[17482],{"type":30,"value":1554},{"type":20,"tag":194,"props":17484,"children":17485},{"style":258},[17486],{"type":30,"value":17465},{"type":20,"tag":194,"props":17488,"children":17489},{"style":264},[17490],{"type":30,"value":17491},"(el);\n",{"type":20,"tag":194,"props":17493,"children":17494},{"class":196,"line":827},[17495],{"type":20,"tag":194,"props":17496,"children":17497},{"emptyLinePlaceholder":546},[17498],{"type":30,"value":549},{"type":20,"tag":194,"props":17500,"children":17501},{"class":196,"line":836},[17502,17507,17512,17516,17520],{"type":20,"tag":194,"props":17503,"children":17504},{"style":264},[17505],{"type":30,"value":17506},"        $el.",{"type":20,"tag":194,"props":17508,"children":17509},{"style":258},[17510],{"type":30,"value":17511},"each",{"type":20,"tag":194,"props":17513,"children":17514},{"style":264},[17515],{"type":30,"value":403},{"type":20,"tag":194,"props":17517,"children":17518},{"style":252},[17519],{"type":30,"value":393},{"type":20,"tag":194,"props":17521,"children":17522},{"style":264},[17523],{"type":30,"value":4121},{"type":20,"tag":194,"props":17525,"children":17526},{"class":196,"line":844},[17527,17531,17535,17539,17544,17548,17553,17557,17561],{"type":20,"tag":194,"props":17528,"children":17529},{"style":252},[17530],{"type":30,"value":13826},{"type":20,"tag":194,"props":17532,"children":17533},{"style":264},[17534],{"type":30,"value":1172},{"type":20,"tag":194,"props":17536,"children":17537},{"style":680},[17538],{"type":30,"value":4174},{"type":20,"tag":194,"props":17540,"children":17541},{"style":264},[17542],{"type":30,"value":17543},".tagName ",{"type":20,"tag":194,"props":17545,"children":17546},{"style":252},[17547],{"type":30,"value":17104},{"type":20,"tag":194,"props":17549,"children":17550},{"style":506},[17551],{"type":30,"value":17552}," 'SELECT'",{"type":20,"tag":194,"props":17554,"children":17555},{"style":264},[17556],{"type":30,"value":514},{"type":20,"tag":194,"props":17558,"children":17559},{"style":252},[17560],{"type":30,"value":1379},{"type":20,"tag":194,"props":17562,"children":17563},{"style":264},[17564],{"type":30,"value":1384},{"type":20,"tag":194,"props":17566,"children":17567},{"class":196,"line":858},[17568,17572,17577,17581,17585,17589,17593],{"type":20,"tag":194,"props":17569,"children":17570},{"style":252},[17571],{"type":30,"value":7360},{"type":20,"tag":194,"props":17573,"children":17574},{"style":264},[17575],{"type":30,"value":17576}," $this ",{"type":20,"tag":194,"props":17578,"children":17579},{"style":252},[17580],{"type":30,"value":461},{"type":20,"tag":194,"props":17582,"children":17583},{"style":258},[17584],{"type":30,"value":17465},{"type":20,"tag":194,"props":17586,"children":17587},{"style":264},[17588],{"type":30,"value":403},{"type":20,"tag":194,"props":17590,"children":17591},{"style":680},[17592],{"type":30,"value":4174},{"type":20,"tag":194,"props":17594,"children":17595},{"style":264},[17596],{"type":30,"value":5651},{"type":20,"tag":194,"props":17598,"children":17599},{"class":196,"line":1726},[17600,17605,17609,17614,17619,17623,17628,17632,17637,17641,17646,17650,17654],{"type":20,"tag":194,"props":17601,"children":17602},{"style":264},[17603],{"type":30,"value":17604},"                opts ",{"type":20,"tag":194,"props":17606,"children":17607},{"style":252},[17608],{"type":30,"value":461},{"type":20,"tag":194,"props":17610,"children":17611},{"style":264},[17612],{"type":30,"value":17613}," $this.",{"type":20,"tag":194,"props":17615,"children":17616},{"style":258},[17617],{"type":30,"value":17618},"find",{"type":20,"tag":194,"props":17620,"children":17621},{"style":264},[17622],{"type":30,"value":403},{"type":20,"tag":194,"props":17624,"children":17625},{"style":506},[17626],{"type":30,"value":17627},"'option'",{"type":20,"tag":194,"props":17629,"children":17630},{"style":264},[17631],{"type":30,"value":529},{"type":20,"tag":194,"props":17633,"children":17634},{"style":258},[17635],{"type":30,"value":17636},"prop",{"type":20,"tag":194,"props":17638,"children":17639},{"style":264},[17640],{"type":30,"value":403},{"type":20,"tag":194,"props":17642,"children":17643},{"style":506},[17644],{"type":30,"value":17645},"'disabled'",{"type":20,"tag":194,"props":17647,"children":17648},{"style":264},[17649],{"type":30,"value":414},{"type":20,"tag":194,"props":17651,"children":17652},{"style":680},[17653],{"type":30,"value":9816},{"type":20,"tag":194,"props":17655,"children":17656},{"style":264},[17657],{"type":30,"value":5651},{"type":20,"tag":194,"props":17659,"children":17660},{"class":196,"line":1743},[17661],{"type":20,"tag":194,"props":17662,"children":17663},{"style":264},[17664],{"type":30,"value":17665},"                spans;\n",{"type":20,"tag":194,"props":17667,"children":17668},{"class":196,"line":1751},[17669],{"type":20,"tag":194,"props":17670,"children":17671},{"emptyLinePlaceholder":546},[17672],{"type":30,"value":549},{"type":20,"tag":194,"props":17674,"children":17675},{"class":196,"line":1776},[17676],{"type":20,"tag":194,"props":17677,"children":17678},{"style":201},[17679],{"type":30,"value":17680},"            // Unwrap all options from their span tags\n",{"type":20,"tag":194,"props":17682,"children":17683},{"class":196,"line":1811},[17684,17688,17693,17697,17702,17706,17710,17714,17718,17723,17728,17732,17737,17742],{"type":20,"tag":194,"props":17685,"children":17686},{"style":252},[17687],{"type":30,"value":13826},{"type":20,"tag":194,"props":17689,"children":17690},{"style":264},[17691],{"type":30,"value":17692}," (needsWrap ",{"type":20,"tag":194,"props":17694,"children":17695},{"style":252},[17696],{"type":30,"value":1920},{"type":20,"tag":194,"props":17698,"children":17699},{"style":264},[17700],{"type":30,"value":17701}," (spans ",{"type":20,"tag":194,"props":17703,"children":17704},{"style":252},[17705],{"type":30,"value":461},{"type":20,"tag":194,"props":17707,"children":17708},{"style":264},[17709],{"type":30,"value":17613},{"type":20,"tag":194,"props":17711,"children":17712},{"style":258},[17713],{"type":30,"value":17618},{"type":20,"tag":194,"props":17715,"children":17716},{"style":264},[17717],{"type":30,"value":403},{"type":20,"tag":194,"props":17719,"children":17720},{"style":506},[17721],{"type":30,"value":17722},"'span'",{"type":20,"tag":194,"props":17724,"children":17725},{"style":264},[17726],{"type":30,"value":17727},")) ",{"type":20,"tag":194,"props":17729,"children":17730},{"style":252},[17731],{"type":30,"value":1920},{"type":20,"tag":194,"props":17733,"children":17734},{"style":264},[17735],{"type":30,"value":17736}," spans.",{"type":20,"tag":194,"props":17738,"children":17739},{"style":680},[17740],{"type":30,"value":17741},"length",{"type":20,"tag":194,"props":17743,"children":17744},{"style":264},[17745],{"type":30,"value":4253},{"type":20,"tag":194,"props":17747,"children":17748},{"class":196,"line":1847},[17749,17754,17759,17763,17768],{"type":20,"tag":194,"props":17750,"children":17751},{"style":264},[17752],{"type":30,"value":17753},"                spans.",{"type":20,"tag":194,"props":17755,"children":17756},{"style":258},[17757],{"type":30,"value":17758},"children",{"type":20,"tag":194,"props":17760,"children":17761},{"style":264},[17762],{"type":30,"value":567},{"type":20,"tag":194,"props":17764,"children":17765},{"style":258},[17766],{"type":30,"value":17767},"unwrap",{"type":20,"tag":194,"props":17769,"children":17770},{"style":264},[17771],{"type":30,"value":539},{"type":20,"tag":194,"props":17773,"children":17774},{"class":196,"line":1901},[17775],{"type":20,"tag":194,"props":17776,"children":17777},{"style":264},[17778],{"type":30,"value":1121},{"type":20,"tag":194,"props":17780,"children":17781},{"class":196,"line":1937},[17782],{"type":20,"tag":194,"props":17783,"children":17784},{"emptyLinePlaceholder":546},[17785],{"type":30,"value":549},{"type":20,"tag":194,"props":17787,"children":17788},{"class":196,"line":1951},[17789,17794,17798,17803,17807,17812,17816,17821,17825,17829,17833,17837,17841,17845],{"type":20,"tag":194,"props":17790,"children":17791},{"style":264},[17792],{"type":30,"value":17793},"            opts ",{"type":20,"tag":194,"props":17795,"children":17796},{"style":252},[17797],{"type":30,"value":461},{"type":20,"tag":194,"props":17799,"children":17800},{"style":264},[17801],{"type":30,"value":17802}," (invert) ",{"type":20,"tag":194,"props":17804,"children":17805},{"style":252},[17806],{"type":30,"value":1544},{"type":20,"tag":194,"props":17808,"children":17809},{"style":264},[17810],{"type":30,"value":17811}," opts.",{"type":20,"tag":194,"props":17813,"children":17814},{"style":258},[17815],{"type":30,"value":5494},{"type":20,"tag":194,"props":17817,"children":17818},{"style":264},[17819],{"type":30,"value":17820},"(filter).",{"type":20,"tag":194,"props":17822,"children":17823},{"style":258},[17824],{"type":30,"value":17636},{"type":20,"tag":194,"props":17826,"children":17827},{"style":264},[17828],{"type":30,"value":403},{"type":20,"tag":194,"props":17830,"children":17831},{"style":506},[17832],{"type":30,"value":17645},{"type":20,"tag":194,"props":17834,"children":17835},{"style":264},[17836],{"type":30,"value":414},{"type":20,"tag":194,"props":17838,"children":17839},{"style":680},[17840],{"type":30,"value":4352},{"type":20,"tag":194,"props":17842,"children":17843},{"style":264},[17844],{"type":30,"value":514},{"type":20,"tag":194,"props":17846,"children":17847},{"style":252},[17848],{"type":30,"value":5867},{"type":20,"tag":194,"props":17850,"children":17851},{"class":196,"line":1959},[17852,17857,17861,17865,17869,17873,17877,17881,17885],{"type":20,"tag":194,"props":17853,"children":17854},{"style":264},[17855],{"type":30,"value":17856},"                opts.",{"type":20,"tag":194,"props":17858,"children":17859},{"style":258},[17860],{"type":30,"value":17421},{"type":20,"tag":194,"props":17862,"children":17863},{"style":264},[17864],{"type":30,"value":17820},{"type":20,"tag":194,"props":17866,"children":17867},{"style":258},[17868],{"type":30,"value":17636},{"type":20,"tag":194,"props":17870,"children":17871},{"style":264},[17872],{"type":30,"value":403},{"type":20,"tag":194,"props":17874,"children":17875},{"style":506},[17876],{"type":30,"value":17645},{"type":20,"tag":194,"props":17878,"children":17879},{"style":264},[17880],{"type":30,"value":414},{"type":20,"tag":194,"props":17882,"children":17883},{"style":680},[17884],{"type":30,"value":4352},{"type":20,"tag":194,"props":17886,"children":17887},{"style":264},[17888],{"type":30,"value":1649},{"type":20,"tag":194,"props":17890,"children":17891},{"class":196,"line":1991},[17892],{"type":20,"tag":194,"props":17893,"children":17894},{"emptyLinePlaceholder":546},[17895],{"type":30,"value":549},{"type":20,"tag":194,"props":17897,"children":17898},{"class":196,"line":2004},[17899],{"type":20,"tag":194,"props":17900,"children":17901},{"style":201},[17902],{"type":30,"value":17903},"            // Wrap options in a single hidden span to hide them on browsers that don't support\n",{"type":20,"tag":194,"props":17905,"children":17906},{"class":196,"line":2012},[17907],{"type":20,"tag":194,"props":17908,"children":17909},{"style":201},[17910],{"type":30,"value":17911},"            // display:none for options\n",{"type":20,"tag":194,"props":17913,"children":17914},{"class":196,"line":2020},[17915,17919],{"type":20,"tag":194,"props":17916,"children":17917},{"style":252},[17918],{"type":30,"value":13826},{"type":20,"tag":194,"props":17920,"children":17921},{"style":264},[17922],{"type":30,"value":17923}," (needsWrap) {\n",{"type":20,"tag":194,"props":17925,"children":17926},{"class":196,"line":2028},[17927,17931,17936,17940,17945],{"type":20,"tag":194,"props":17928,"children":17929},{"style":264},[17930],{"type":30,"value":17856},{"type":20,"tag":194,"props":17932,"children":17933},{"style":258},[17934],{"type":30,"value":17935},"wrapAll",{"type":20,"tag":194,"props":17937,"children":17938},{"style":264},[17939],{"type":30,"value":403},{"type":20,"tag":194,"props":17941,"children":17942},{"style":506},[17943],{"type":30,"value":17944},"'\u003Cspan class=\"hide\">\u003C/span>'",{"type":20,"tag":194,"props":17946,"children":17947},{"style":264},[17948],{"type":30,"value":1649},{"type":20,"tag":194,"props":17950,"children":17951},{"class":196,"line":2037},[17952,17956,17960,17964,17969,17973,17977],{"type":20,"tag":194,"props":17953,"children":17954},{"style":264},[17955],{"type":30,"value":17604},{"type":20,"tag":194,"props":17957,"children":17958},{"style":252},[17959],{"type":30,"value":461},{"type":20,"tag":194,"props":17961,"children":17962},{"style":264},[17963],{"type":30,"value":17811},{"type":20,"tag":194,"props":17965,"children":17966},{"style":258},[17967],{"type":30,"value":17968},"parent",{"type":20,"tag":194,"props":17970,"children":17971},{"style":264},[17972],{"type":30,"value":403},{"type":20,"tag":194,"props":17974,"children":17975},{"style":506},[17976],{"type":30,"value":17722},{"type":20,"tag":194,"props":17978,"children":17979},{"style":264},[17980],{"type":30,"value":1649},{"type":20,"tag":194,"props":17982,"children":17983},{"class":196,"line":2045},[17984],{"type":20,"tag":194,"props":17985,"children":17986},{"style":264},[17987],{"type":30,"value":1121},{"type":20,"tag":194,"props":17989,"children":17990},{"class":196,"line":2066},[17991],{"type":20,"tag":194,"props":17992,"children":17993},{"emptyLinePlaceholder":546},[17994],{"type":30,"value":549},{"type":20,"tag":194,"props":17996,"children":17997},{"class":196,"line":2087},[17998,18003,18008,18012,18017],{"type":20,"tag":194,"props":17999,"children":18000},{"style":264},[18001],{"type":30,"value":18002},"            opts.",{"type":20,"tag":194,"props":18004,"children":18005},{"style":258},[18006],{"type":30,"value":18007},"detach",{"type":20,"tag":194,"props":18009,"children":18010},{"style":264},[18011],{"type":30,"value":567},{"type":20,"tag":194,"props":18013,"children":18014},{"style":258},[18015],{"type":30,"value":18016},"appendTo",{"type":20,"tag":194,"props":18018,"children":18019},{"style":264},[18020],{"type":30,"value":18021},"($this);\n",{"type":20,"tag":194,"props":18023,"children":18024},{"class":196,"line":2095},[18025],{"type":20,"tag":194,"props":18026,"children":18027},{"style":264},[18028],{"type":30,"value":2779},{"type":20,"tag":194,"props":18030,"children":18031},{"class":196,"line":2128},[18032],{"type":20,"tag":194,"props":18033,"children":18034},{"emptyLinePlaceholder":546},[18035],{"type":30,"value":549},{"type":20,"tag":194,"props":18037,"children":18038},{"class":196,"line":2147},[18039,18043],{"type":20,"tag":194,"props":18040,"children":18041},{"style":252},[18042],{"type":30,"value":1591},{"type":20,"tag":194,"props":18044,"children":18045},{"style":264},[18046],{"type":30,"value":18047}," $el;\n",{"type":20,"tag":194,"props":18049,"children":18050},{"class":196,"line":2175},[18051],{"type":20,"tag":194,"props":18052,"children":18053},{"style":264},[18054],{"type":30,"value":3940},{"type":20,"tag":194,"props":18056,"children":18057},{"class":196,"line":2203},[18058],{"type":20,"tag":194,"props":18059,"children":18060},{"emptyLinePlaceholder":546},[18061],{"type":30,"value":549},{"type":20,"tag":194,"props":18063,"children":18064},{"class":196,"line":2211},[18065],{"type":20,"tag":194,"props":18066,"children":18067},{"style":201},[18068],{"type":30,"value":1399},{"type":20,"tag":194,"props":18070,"children":18071},{"class":196,"line":2219},[18072],{"type":20,"tag":194,"props":18073,"children":18074},{"style":201},[18075],{"type":30,"value":18076},"     * Allow for the $(element) form of invocation.\n",{"type":20,"tag":194,"props":18078,"children":18079},{"class":196,"line":2227},[18080,18084,18088,18092],{"type":20,"tag":194,"props":18081,"children":18082},{"style":201},[18083],{"type":30,"value":1431},{"type":20,"tag":194,"props":18085,"children":18086},{"style":252},[18087],{"type":30,"value":255},{"type":20,"tag":194,"props":18089,"children":18090},{"style":258},[18091],{"type":30,"value":17334},{"type":20,"tag":194,"props":18093,"children":18094},{"style":264},[18095],{"type":30,"value":17339},{"type":20,"tag":194,"props":18097,"children":18098},{"class":196,"line":2236},[18099,18103,18107,18111],{"type":20,"tag":194,"props":18100,"children":18101},{"style":201},[18102],{"type":30,"value":1431},{"type":20,"tag":194,"props":18104,"children":18105},{"style":252},[18106],{"type":30,"value":255},{"type":20,"tag":194,"props":18108,"children":18109},{"style":258},[18110],{"type":30,"value":17355},{"type":20,"tag":194,"props":18112,"children":18113},{"style":264},[18114],{"type":30,"value":17360},{"type":20,"tag":194,"props":18116,"children":18117},{"class":196,"line":2245},[18118,18122,18126],{"type":20,"tag":194,"props":18119,"children":18120},{"style":201},[18121],{"type":30,"value":1431},{"type":20,"tag":194,"props":18123,"children":18124},{"style":252},[18125],{"type":30,"value":964},{"type":20,"tag":194,"props":18127,"children":18128},{"style":258},[18129],{"type":30,"value":17376},{"type":20,"tag":194,"props":18131,"children":18132},{"class":196,"line":2254},[18133],{"type":20,"tag":194,"props":18134,"children":18135},{"style":201},[18136],{"type":30,"value":1448},{"type":20,"tag":194,"props":18138,"children":18139},{"class":196,"line":2262},[18140,18145,18149,18153,18157,18161,18165,18169,18173],{"type":20,"tag":194,"props":18141,"children":18142},{"style":264},[18143],{"type":30,"value":18144},"    $.fn.",{"type":20,"tag":194,"props":18146,"children":18147},{"style":258},[18148],{"type":30,"value":17395},{"type":20,"tag":194,"props":18150,"children":18151},{"style":252},[18152],{"type":30,"value":3298},{"type":20,"tag":194,"props":18154,"children":18155},{"style":252},[18156],{"type":30,"value":3303},{"type":20,"tag":194,"props":18158,"children":18159},{"style":264},[18160],{"type":30,"value":403},{"type":20,"tag":194,"props":18162,"children":18163},{"style":406},[18164],{"type":30,"value":17421},{"type":20,"tag":194,"props":18166,"children":18167},{"style":264},[18168],{"type":30,"value":414},{"type":20,"tag":194,"props":18170,"children":18171},{"style":406},[18172],{"type":30,"value":17430},{"type":20,"tag":194,"props":18174,"children":18175},{"style":264},[18176],{"type":30,"value":4253},{"type":20,"tag":194,"props":18178,"children":18179},{"class":196,"line":2286},[18180,18184,18188,18192,18196,18200],{"type":20,"tag":194,"props":18181,"children":18182},{"style":252},[18183],{"type":30,"value":1591},{"type":20,"tag":194,"props":18185,"children":18186},{"style":264},[18187],{"type":30,"value":9118},{"type":20,"tag":194,"props":18189,"children":18190},{"style":258},[18191],{"type":30,"value":17395},{"type":20,"tag":194,"props":18193,"children":18194},{"style":264},[18195],{"type":30,"value":403},{"type":20,"tag":194,"props":18197,"children":18198},{"style":680},[18199],{"type":30,"value":4174},{"type":20,"tag":194,"props":18201,"children":18202},{"style":264},[18203],{"type":30,"value":18204},", filter, invert);\n",{"type":20,"tag":194,"props":18206,"children":18207},{"class":196,"line":2295},[18208],{"type":20,"tag":194,"props":18209,"children":18210},{"style":264},[18211],{"type":30,"value":3940},{"type":20,"tag":194,"props":18213,"children":18214},{"class":196,"line":2319},[18215],{"type":20,"tag":194,"props":18216,"children":18217},{"style":264},[18218],{"type":30,"value":18219},"})(jQuery);\n",{"type":20,"tag":21,"props":18221,"children":18222},{},[18223],{"type":30,"value":18224},"Usage for this plugin looks like:",{"type":20,"tag":184,"props":18226,"children":18228},{"className":186,"code":18227,"language":188,"meta":8,"style":8},"$.elideOptions('#mydiv select', function(){ \n    /* return true to keep option in selected set */\n});\n",[18229],{"type":20,"tag":68,"props":18230,"children":18231},{"__ignoreMap":8},[18232,18265,18273],{"type":20,"tag":194,"props":18233,"children":18234},{"class":196,"line":197},[18235,18239,18243,18247,18252,18256,18260],{"type":20,"tag":194,"props":18236,"children":18237},{"style":264},[18238],{"type":30,"value":4427},{"type":20,"tag":194,"props":18240,"children":18241},{"style":258},[18242],{"type":30,"value":17395},{"type":20,"tag":194,"props":18244,"children":18245},{"style":264},[18246],{"type":30,"value":403},{"type":20,"tag":194,"props":18248,"children":18249},{"style":506},[18250],{"type":30,"value":18251},"'#mydiv select'",{"type":20,"tag":194,"props":18253,"children":18254},{"style":264},[18255],{"type":30,"value":414},{"type":20,"tag":194,"props":18257,"children":18258},{"style":252},[18259],{"type":30,"value":393},{"type":20,"tag":194,"props":18261,"children":18262},{"style":264},[18263],{"type":30,"value":18264},"(){ \n",{"type":20,"tag":194,"props":18266,"children":18267},{"class":196,"line":207},[18268],{"type":20,"tag":194,"props":18269,"children":18270},{"style":201},[18271],{"type":30,"value":18272},"    /* return true to keep option in selected set */\n",{"type":20,"tag":194,"props":18274,"children":18275},{"class":196,"line":216},[18276],{"type":20,"tag":194,"props":18277,"children":18278},{"style":264},[18279],{"type":30,"value":4204},{"type":20,"tag":21,"props":18281,"children":18282},{},[18283],{"type":30,"value":18284},"OR",{"type":20,"tag":184,"props":18286,"children":18288},{"className":186,"code":18287,"language":188,"meta":8,"style":8},"$('#mydiv select').elideOptions(function(){ \n    /* return true to keep option in selected set */ \n});\n",[18289],{"type":20,"tag":68,"props":18290,"children":18291},{"__ignoreMap":8},[18292,18327,18339],{"type":20,"tag":194,"props":18293,"children":18294},{"class":196,"line":197},[18295,18299,18303,18307,18311,18315,18319,18323],{"type":20,"tag":194,"props":18296,"children":18297},{"style":258},[18298],{"type":30,"value":6468},{"type":20,"tag":194,"props":18300,"children":18301},{"style":264},[18302],{"type":30,"value":403},{"type":20,"tag":194,"props":18304,"children":18305},{"style":506},[18306],{"type":30,"value":18251},{"type":20,"tag":194,"props":18308,"children":18309},{"style":264},[18310],{"type":30,"value":529},{"type":20,"tag":194,"props":18312,"children":18313},{"style":258},[18314],{"type":30,"value":17395},{"type":20,"tag":194,"props":18316,"children":18317},{"style":264},[18318],{"type":30,"value":403},{"type":20,"tag":194,"props":18320,"children":18321},{"style":252},[18322],{"type":30,"value":393},{"type":20,"tag":194,"props":18324,"children":18325},{"style":264},[18326],{"type":30,"value":18264},{"type":20,"tag":194,"props":18328,"children":18329},{"class":196,"line":207},[18330,18335],{"type":20,"tag":194,"props":18331,"children":18332},{"style":201},[18333],{"type":30,"value":18334},"    /* return true to keep option in selected set */",{"type":20,"tag":194,"props":18336,"children":18337},{"style":264},[18338],{"type":30,"value":8159},{"type":20,"tag":194,"props":18340,"children":18341},{"class":196,"line":216},[18342],{"type":20,"tag":194,"props":18343,"children":18344},{"style":264},[18345],{"type":30,"value":4204},{"type":20,"tag":21,"props":18347,"children":18348},{},[18349,18351,18356,18358,18363,18365,18370],{"type":30,"value":18350},"Additionally, you can specify a third optional parameter, ",{"type":20,"tag":68,"props":18352,"children":18354},{"className":18353},[],[18355],{"type":30,"value":17430},{"type":30,"value":18357}," - if true, the logic of the filter function is inverted (that is, options that match the criteria [ie. you return true from the filter function] will be omitted from the options that will be acted upon - essentially, using ",{"type":20,"tag":68,"props":18359,"children":18361},{"className":18360},[],[18362],{"type":30,"value":5494},{"type":30,"value":18364}," instead of ",{"type":20,"tag":68,"props":18366,"children":18368},{"className":18367},[],[18369],{"type":30,"value":17421},{"type":30,"value":18371}," on the set).",{"type":20,"tag":21,"props":18373,"children":18374},{},[18375,18377,18384],{"type":30,"value":18376},"As per the comments at the top of the above gist, we work around our issue with Chrome by performing the disable as per usual, then ",{"type":20,"tag":25,"props":18378,"children":18381},{"href":18379,"rel":18380},"https://api.jquery.com/detach/",[50],[18382],{"type":30,"value":18383},"detaching",{"type":30,"value":18385}," the disabled options from the select, and appending them back onto the end of the select.",{"type":20,"tag":21,"props":18387,"children":18388},{},[18389],{"type":30,"value":18390},"The behaviour of this bug is such that any visible options that occur after hidden elements aren't counted towards the height of the list box - by ensuring all visible options will be above any hidden options, we avoid this behaviour. Now we can still filter on the elements within the select, not needing to create a shadow element or object to store state for this select, while still having the select dropdown expand to the dimensions of the visible options as expected.",{"type":20,"tag":21,"props":18392,"children":18393},{},[18394,18396,18403],{"type":30,"value":18395},"So, we know the how - but are you curious as to the why? The answer lurks somewhere in ",{"type":20,"tag":25,"props":18397,"children":18400},{"href":18398,"rel":18399},"https://codereview.chromium.org/189543012/diff/200001/Source/core/rendering/RenderListBox.cpp",[50],[18401],{"type":30,"value":18402},"this diff",{"type":30,"value":18404},". I've only had time to give it a cursory read-through - there's not a lot to go on, given the lack of documentation (come on guys, a doc-block per function wouldn't be that hard), but given the bug behaviour, it probably has something to do with either the calculation of the list box height only including those items encountered before the first hidden item, or with the lastIndex being calculated as the last visible element before the first hidden element.",{"type":20,"tag":21,"props":18406,"children":18407},{},[18408],{"type":30,"value":18409},"Need to get the job done today? My plugin can help with that. Want to be a hero? Go fix this for realsies.",{"type":20,"tag":3951,"props":18411,"children":18412},{},[18413],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":18415},[],"content:ckeefer:2014-4:hidden-options.md","ckeefer/2014-4/hidden-options.md","ckeefer/2014-4/hidden-options",{"user":3970,"name":3971},{"_path":18421,"_dir":18422,"_draft":7,"_partial":7,"_locale":8,"title":18423,"description":18424,"publishDate":18425,"tags":18426,"image":18428,"excerpt":18424,"body":18429,"_type":3963,"_id":21111,"_source":3965,"_file":21112,"_stem":21113,"_extension":3968,"author":21114},"/ckeefer/2013-5/ajax-uploader","2013-5","Ajax Upload XHR2, Take 2","It's a pleasure to be able to interact with files in the browser at long last, isn't it? Reading files in without needing to bounce them against the server first opens up a lot of possibilities - and getting progress from a chunked ajax upload is miles away from the indeterminate form uploads of days past.","2014-02-19",[14,13,18427],"xhr2","/ckeefer/2013-5/img/html5.jpg",{"type":17,"children":18430,"toc":21106},[18431,18435,18445,18459,18465,18479,18492,19031,19036,19041,19046,19051,19774,19795,19800,21058,21064,21069,21074,21080,21102],{"type":20,"tag":21,"props":18432,"children":18433},{},[18434],{"type":30,"value":18424},{"type":20,"tag":21,"props":18436,"children":18437},{},[18438,18443],{"type":20,"tag":25,"props":18439,"children":18441},{"href":18440},"/search/ajax/upload/filereader/user:ckeefer",[18442],{"type":30,"value":31},{"type":30,"value":18444}," we touched this subject, I shared an (admittedly rough) jQuery plugin that allowed you to enjoy HTML5 ajax uploading and file reading with the familiar event interface, and convert any element into a drag-and-drop target.",{"type":20,"tag":21,"props":18446,"children":18447},{},[18448,18450,18457],{"type":30,"value":18449},"At the request of reader ",{"type":20,"tag":25,"props":18451,"children":18454},{"href":18452,"rel":18453},"https://github.com/SaneMethod/HUp/issues/1",[50],[18455],{"type":30,"value":18456},"Mateusz",{"type":30,"value":18458},", let's revisit our HUp plugin, and polish it up a little by adding a new feature - the ability to filter files to be read/uploaded by their file size, and/or their mime-type.",{"type":20,"tag":5510,"props":18460,"children":18462},{"id":18461},"filtering-by-type",[18463],{"type":30,"value":18464},"Filtering By Type",{"type":20,"tag":21,"props":18466,"children":18467},{},[18468,18470,18477],{"type":30,"value":18469},"This can get tricky, given the wide variety of files and their associated mime types. We want to be able to specify something similar to the ",{"type":20,"tag":25,"props":18471,"children":18474},{"href":18472,"rel":18473},"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Specifications",[50],[18475],{"type":30,"value":18476},"accept attribute",{"type":30,"value":18478}," on file inputs - but a little looser and friendlier, allowing just the extension to be specified, with the plugin handling the hard work of mapping that to a mime-type - at least, when we know the extension.",{"type":20,"tag":21,"props":18480,"children":18481},{},[18482,18484,18490],{"type":30,"value":18483},"The logic for this is split up within ",{"type":20,"tag":68,"props":18485,"children":18487},{"className":18486},[],[18488],{"type":30,"value":18489},"hup.js",{"type":30,"value":18491},". To begin with, we need to create an array of known mime-types, and a mapping between extensions and their mime-types.",{"type":20,"tag":184,"props":18493,"children":18495},{"className":186,"code":18494,"language":188,"meta":8,"style":8},"var filters = {},\n    fileTypes = [];\n    /**\n    * Populate the filters and fileTypes object and array, with the former containing a mapping between\n    * file extensions and their mime types, and the latter the mimetypes themselves.\n    */\n(function(mimetypes){\n    var mimes = mimetypes.split(/,/),\n        exts = [];\n    for (var i=0, len=mimes.length; i \u003C len; i+=2)\n    {\n        fileTypes.push(mimes[i]);\n        exts = mimes[i+1].split(/ /);\n        for (var j=0, jlen = exts.length; j \u003C jlen; j++)\n        {\n            filters[exts[j]] = mimes[i];\n        }\n    }\n})(\n        \"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,\" +\n        \"ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,\" +\n        \"ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/x-javascript,js,\" +\n        \"application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,\" +\n        \"image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,\" +\n        \"image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,\" +\n        \"csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,\" +\n        \"video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,\" +\n        \"application/octet-stream,exe\"\n    );\n",[18496],{"type":20,"tag":68,"props":18497,"children":18498},{"__ignoreMap":8},[18499,18520,18537,18544,18552,18560,18567,18591,18638,18654,18728,18736,18754,18804,18874,18881,18898,18905,18912,18920,18932,18944,18956,18968,18980,18992,19004,19016,19024],{"type":20,"tag":194,"props":18500,"children":18501},{"class":196,"line":197},[18502,18506,18511,18515],{"type":20,"tag":194,"props":18503,"children":18504},{"style":252},[18505],{"type":30,"value":4057},{"type":20,"tag":194,"props":18507,"children":18508},{"style":264},[18509],{"type":30,"value":18510}," filters ",{"type":20,"tag":194,"props":18512,"children":18513},{"style":252},[18514],{"type":30,"value":461},{"type":20,"tag":194,"props":18516,"children":18517},{"style":264},[18518],{"type":30,"value":18519}," {},\n",{"type":20,"tag":194,"props":18521,"children":18522},{"class":196,"line":207},[18523,18528,18532],{"type":20,"tag":194,"props":18524,"children":18525},{"style":264},[18526],{"type":30,"value":18527},"    fileTypes ",{"type":20,"tag":194,"props":18529,"children":18530},{"style":252},[18531],{"type":30,"value":461},{"type":20,"tag":194,"props":18533,"children":18534},{"style":264},[18535],{"type":30,"value":18536}," [];\n",{"type":20,"tag":194,"props":18538,"children":18539},{"class":196,"line":216},[18540],{"type":20,"tag":194,"props":18541,"children":18542},{"style":201},[18543],{"type":30,"value":1399},{"type":20,"tag":194,"props":18545,"children":18546},{"class":196,"line":225},[18547],{"type":20,"tag":194,"props":18548,"children":18549},{"style":201},[18550],{"type":30,"value":18551},"    * Populate the filters and fileTypes object and array, with the former containing a mapping between\n",{"type":20,"tag":194,"props":18553,"children":18554},{"class":196,"line":234},[18555],{"type":20,"tag":194,"props":18556,"children":18557},{"style":201},[18558],{"type":30,"value":18559},"    * file extensions and their mime types, and the latter the mimetypes themselves.\n",{"type":20,"tag":194,"props":18561,"children":18562},{"class":196,"line":243},[18563],{"type":20,"tag":194,"props":18564,"children":18565},{"style":201},[18566],{"type":30,"value":384},{"type":20,"tag":194,"props":18568,"children":18569},{"class":196,"line":275},[18570,18574,18578,18582,18587],{"type":20,"tag":194,"props":18571,"children":18572},{"style":264},[18573],{"type":30,"value":403},{"type":20,"tag":194,"props":18575,"children":18576},{"style":252},[18577],{"type":30,"value":393},{"type":20,"tag":194,"props":18579,"children":18580},{"style":264},[18581],{"type":30,"value":403},{"type":20,"tag":194,"props":18583,"children":18584},{"style":406},[18585],{"type":30,"value":18586},"mimetypes",{"type":20,"tag":194,"props":18588,"children":18589},{"style":264},[18590],{"type":30,"value":4253},{"type":20,"tag":194,"props":18592,"children":18593},{"class":196,"line":284},[18594,18598,18603,18607,18612,18617,18621,18625,18630,18634],{"type":20,"tag":194,"props":18595,"children":18596},{"style":252},[18597],{"type":30,"value":451},{"type":20,"tag":194,"props":18599,"children":18600},{"style":264},[18601],{"type":30,"value":18602}," mimes ",{"type":20,"tag":194,"props":18604,"children":18605},{"style":252},[18606],{"type":30,"value":461},{"type":20,"tag":194,"props":18608,"children":18609},{"style":264},[18610],{"type":30,"value":18611}," mimetypes.",{"type":20,"tag":194,"props":18613,"children":18614},{"style":258},[18615],{"type":30,"value":18616},"split",{"type":20,"tag":194,"props":18618,"children":18619},{"style":264},[18620],{"type":30,"value":403},{"type":20,"tag":194,"props":18622,"children":18623},{"style":506},[18624],{"type":30,"value":12085},{"type":20,"tag":194,"props":18626,"children":18627},{"style":12088},[18628],{"type":30,"value":18629},",",{"type":20,"tag":194,"props":18631,"children":18632},{"style":506},[18633],{"type":30,"value":12085},{"type":20,"tag":194,"props":18635,"children":18636},{"style":264},[18637],{"type":30,"value":5651},{"type":20,"tag":194,"props":18639,"children":18640},{"class":196,"line":311},[18641,18646,18650],{"type":20,"tag":194,"props":18642,"children":18643},{"style":264},[18644],{"type":30,"value":18645},"        exts ",{"type":20,"tag":194,"props":18647,"children":18648},{"style":252},[18649],{"type":30,"value":461},{"type":20,"tag":194,"props":18651,"children":18652},{"style":264},[18653],{"type":30,"value":18536},{"type":20,"tag":194,"props":18655,"children":18656},{"class":196,"line":320},[18657,18662,18666,18670,18675,18679,18683,18688,18692,18697,18701,18706,18710,18715,18720,18724],{"type":20,"tag":194,"props":18658,"children":18659},{"style":252},[18660],{"type":30,"value":18661},"    for",{"type":20,"tag":194,"props":18663,"children":18664},{"style":264},[18665],{"type":30,"value":1172},{"type":20,"tag":194,"props":18667,"children":18668},{"style":252},[18669],{"type":30,"value":4057},{"type":20,"tag":194,"props":18671,"children":18672},{"style":264},[18673],{"type":30,"value":18674}," i",{"type":20,"tag":194,"props":18676,"children":18677},{"style":252},[18678],{"type":30,"value":461},{"type":20,"tag":194,"props":18680,"children":18681},{"style":680},[18682],{"type":30,"value":6487},{"type":20,"tag":194,"props":18684,"children":18685},{"style":264},[18686],{"type":30,"value":18687},", len",{"type":20,"tag":194,"props":18689,"children":18690},{"style":252},[18691],{"type":30,"value":461},{"type":20,"tag":194,"props":18693,"children":18694},{"style":264},[18695],{"type":30,"value":18696},"mimes.",{"type":20,"tag":194,"props":18698,"children":18699},{"style":680},[18700],{"type":30,"value":17741},{"type":20,"tag":194,"props":18702,"children":18703},{"style":264},[18704],{"type":30,"value":18705},"; i ",{"type":20,"tag":194,"props":18707,"children":18708},{"style":252},[18709],{"type":30,"value":3674},{"type":20,"tag":194,"props":18711,"children":18712},{"style":264},[18713],{"type":30,"value":18714}," len; i",{"type":20,"tag":194,"props":18716,"children":18717},{"style":252},[18718],{"type":30,"value":18719},"+=",{"type":20,"tag":194,"props":18721,"children":18722},{"style":680},[18723],{"type":30,"value":15955},{"type":20,"tag":194,"props":18725,"children":18726},{"style":264},[18727],{"type":30,"value":5702},{"type":20,"tag":194,"props":18729,"children":18730},{"class":196,"line":347},[18731],{"type":20,"tag":194,"props":18732,"children":18733},{"style":264},[18734],{"type":30,"value":18735},"    {\n",{"type":20,"tag":194,"props":18737,"children":18738},{"class":196,"line":356},[18739,18744,18749],{"type":20,"tag":194,"props":18740,"children":18741},{"style":264},[18742],{"type":30,"value":18743},"        fileTypes.",{"type":20,"tag":194,"props":18745,"children":18746},{"style":258},[18747],{"type":30,"value":18748},"push",{"type":20,"tag":194,"props":18750,"children":18751},{"style":264},[18752],{"type":30,"value":18753},"(mimes[i]);\n",{"type":20,"tag":194,"props":18755,"children":18756},{"class":196,"line":378},[18757,18761,18765,18770,18774,18778,18783,18787,18791,18795,18800],{"type":20,"tag":194,"props":18758,"children":18759},{"style":264},[18760],{"type":30,"value":18645},{"type":20,"tag":194,"props":18762,"children":18763},{"style":252},[18764],{"type":30,"value":461},{"type":20,"tag":194,"props":18766,"children":18767},{"style":264},[18768],{"type":30,"value":18769}," mimes[i",{"type":20,"tag":194,"props":18771,"children":18772},{"style":252},[18773],{"type":30,"value":649},{"type":20,"tag":194,"props":18775,"children":18776},{"style":680},[18777],{"type":30,"value":9401},{"type":20,"tag":194,"props":18779,"children":18780},{"style":264},[18781],{"type":30,"value":18782},"].",{"type":20,"tag":194,"props":18784,"children":18785},{"style":258},[18786],{"type":30,"value":18616},{"type":20,"tag":194,"props":18788,"children":18789},{"style":264},[18790],{"type":30,"value":403},{"type":20,"tag":194,"props":18792,"children":18793},{"style":506},[18794],{"type":30,"value":12085},{"type":20,"tag":194,"props":18796,"children":18797},{"style":506},[18798],{"type":30,"value":18799}," /",{"type":20,"tag":194,"props":18801,"children":18802},{"style":264},[18803],{"type":30,"value":1649},{"type":20,"tag":194,"props":18805,"children":18806},{"class":196,"line":387},[18807,18812,18816,18820,18825,18829,18833,18838,18842,18847,18851,18856,18860,18865,18870],{"type":20,"tag":194,"props":18808,"children":18809},{"style":252},[18810],{"type":30,"value":18811},"        for",{"type":20,"tag":194,"props":18813,"children":18814},{"style":264},[18815],{"type":30,"value":1172},{"type":20,"tag":194,"props":18817,"children":18818},{"style":252},[18819],{"type":30,"value":4057},{"type":20,"tag":194,"props":18821,"children":18822},{"style":264},[18823],{"type":30,"value":18824}," j",{"type":20,"tag":194,"props":18826,"children":18827},{"style":252},[18828],{"type":30,"value":461},{"type":20,"tag":194,"props":18830,"children":18831},{"style":680},[18832],{"type":30,"value":6487},{"type":20,"tag":194,"props":18834,"children":18835},{"style":264},[18836],{"type":30,"value":18837},", jlen ",{"type":20,"tag":194,"props":18839,"children":18840},{"style":252},[18841],{"type":30,"value":461},{"type":20,"tag":194,"props":18843,"children":18844},{"style":264},[18845],{"type":30,"value":18846}," exts.",{"type":20,"tag":194,"props":18848,"children":18849},{"style":680},[18850],{"type":30,"value":17741},{"type":20,"tag":194,"props":18852,"children":18853},{"style":264},[18854],{"type":30,"value":18855},"; j ",{"type":20,"tag":194,"props":18857,"children":18858},{"style":252},[18859],{"type":30,"value":3674},{"type":20,"tag":194,"props":18861,"children":18862},{"style":264},[18863],{"type":30,"value":18864}," jlen; j",{"type":20,"tag":194,"props":18866,"children":18867},{"style":252},[18868],{"type":30,"value":18869},"++",{"type":20,"tag":194,"props":18871,"children":18872},{"style":264},[18873],{"type":30,"value":5702},{"type":20,"tag":194,"props":18875,"children":18876},{"class":196,"line":445},[18877],{"type":20,"tag":194,"props":18878,"children":18879},{"style":264},[18880],{"type":30,"value":1057},{"type":20,"tag":194,"props":18882,"children":18883},{"class":196,"line":479},[18884,18889,18893],{"type":20,"tag":194,"props":18885,"children":18886},{"style":264},[18887],{"type":30,"value":18888},"            filters[exts[j]] ",{"type":20,"tag":194,"props":18890,"children":18891},{"style":252},[18892],{"type":30,"value":461},{"type":20,"tag":194,"props":18894,"children":18895},{"style":264},[18896],{"type":30,"value":18897}," mimes[i];\n",{"type":20,"tag":194,"props":18899,"children":18900},{"class":196,"line":542},[18901],{"type":20,"tag":194,"props":18902,"children":18903},{"style":264},[18904],{"type":30,"value":824},{"type":20,"tag":194,"props":18906,"children":18907},{"class":196,"line":552},[18908],{"type":20,"tag":194,"props":18909,"children":18910},{"style":264},[18911],{"type":30,"value":1657},{"type":20,"tag":194,"props":18913,"children":18914},{"class":196,"line":598},[18915],{"type":20,"tag":194,"props":18916,"children":18917},{"style":264},[18918],{"type":30,"value":18919},"})(\n",{"type":20,"tag":194,"props":18921,"children":18922},{"class":196,"line":611},[18923,18928],{"type":20,"tag":194,"props":18924,"children":18925},{"style":506},[18926],{"type":30,"value":18927},"        \"application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,\"",{"type":20,"tag":194,"props":18929,"children":18930},{"style":252},[18931],{"type":30,"value":1988},{"type":20,"tag":194,"props":18933,"children":18934},{"class":196,"line":630},[18935,18940],{"type":20,"tag":194,"props":18936,"children":18937},{"style":506},[18938],{"type":30,"value":18939},"        \"ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,\"",{"type":20,"tag":194,"props":18941,"children":18942},{"style":252},[18943],{"type":30,"value":1988},{"type":20,"tag":194,"props":18945,"children":18946},{"class":196,"line":713},[18947,18952],{"type":20,"tag":194,"props":18948,"children":18949},{"style":506},[18950],{"type":30,"value":18951},"        \"ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/x-javascript,js,\"",{"type":20,"tag":194,"props":18953,"children":18954},{"style":252},[18955],{"type":30,"value":1988},{"type":20,"tag":194,"props":18957,"children":18958},{"class":196,"line":743},[18959,18964],{"type":20,"tag":194,"props":18960,"children":18961},{"style":506},[18962],{"type":30,"value":18963},"        \"application/json,json,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,\"",{"type":20,"tag":194,"props":18965,"children":18966},{"style":252},[18967],{"type":30,"value":1988},{"type":20,"tag":194,"props":18969,"children":18970},{"class":196,"line":762},[18971,18976],{"type":20,"tag":194,"props":18972,"children":18973},{"style":506},[18974],{"type":30,"value":18975},"        \"image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,\"",{"type":20,"tag":194,"props":18977,"children":18978},{"style":252},[18979],{"type":30,"value":1988},{"type":20,"tag":194,"props":18981,"children":18982},{"class":196,"line":771},[18983,18988],{"type":20,"tag":194,"props":18984,"children":18985},{"style":506},[18986],{"type":30,"value":18987},"        \"image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,\"",{"type":20,"tag":194,"props":18989,"children":18990},{"style":252},[18991],{"type":30,"value":1988},{"type":20,"tag":194,"props":18993,"children":18994},{"class":196,"line":785},[18995,19000],{"type":20,"tag":194,"props":18996,"children":18997},{"style":506},[18998],{"type":30,"value":18999},"        \"csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,\"",{"type":20,"tag":194,"props":19001,"children":19002},{"style":252},[19003],{"type":30,"value":1988},{"type":20,"tag":194,"props":19005,"children":19006},{"class":196,"line":818},[19007,19012],{"type":20,"tag":194,"props":19008,"children":19009},{"style":506},[19010],{"type":30,"value":19011},"        \"video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gp,video/3gpp2,3g2,\"",{"type":20,"tag":194,"props":19013,"children":19014},{"style":252},[19015],{"type":30,"value":1988},{"type":20,"tag":194,"props":19017,"children":19018},{"class":196,"line":827},[19019],{"type":20,"tag":194,"props":19020,"children":19021},{"style":506},[19022],{"type":30,"value":19023},"        \"application/octet-stream,exe\"\n",{"type":20,"tag":194,"props":19025,"children":19026},{"class":196,"line":836},[19027],{"type":20,"tag":194,"props":19028,"children":19029},{"style":264},[19030],{"type":30,"value":1136},{"type":20,"tag":21,"props":19032,"children":19033},{},[19034],{"type":30,"value":19035},"You're probably wincing a bit at the two var declarations at the top, but remember this is in a closure - those aren't global, they're local to the closure. The function that populates the array and object will run once, when the plugin closure itself first executes.",{"type":20,"tag":21,"props":19037,"children":19038},{},[19039],{"type":30,"value":19040},"So what's happening here? We have a mixed comma and space delimited list of known mime-types and extensions, with the extensions always next to their relevant mime-type. We first split the list on commas and push the first element (the mime-type), to our fileTypes array. Then, we split the i+1 element (the file extensions) on space, and create a key for each of the extensions with the value the mime-type.",{"type":20,"tag":21,"props":19042,"children":19043},{},[19044],{"type":30,"value":19045},"Why build our array and object from a string like this, instead of just specifying them statically? Well, besides the advantage of being able to build two objects for the price of one (that is, both the array and filter), this allows for easy editing and extension of our admittedly incomplete mime-type and file extension list. Need to add another file extension that should be considered application/octet-stream? Just add a space and the new extension next to exe there. Want to have .md files considered as text/plain? Just drop the extension in next to log.",{"type":20,"tag":21,"props":19047,"children":19048},{},[19049],{"type":30,"value":19050},"Next, when the plugin is called on an element with accept set in its options:",{"type":20,"tag":184,"props":19052,"children":19054},{"className":186,"code":19053,"language":188,"meta":8,"style":8},"/**\n* Translate the accept string or array into an array of mime types, based on the mime types in filters.\n* Input should look like the expected extensions:\n* \"swf, wmv, mp4\" or ['swf', 'wmv', 'mp4']\n* Or like mime type categories, or the mime types themselves:\n* \"application/*, application/pdf\" or ['image/\u003Cem>', 'plain/text']\n* @param {array|string} accept\n*/\nHup.prototype.acceptFilters = function(accept){\n    var mimes = [];\n    // Ensure accept is an array of extensions or mime types\n    if (typeof accept === 'string' || accept instanceof String)\n    {\n        accept = accept.split(/,/);\n    }\n    for (var i=0, len = accept.length; i \u003C len; i++)\n    {\n        var mime = accept[i].trim().split(///);\n        if (mime.length > 1)\n        {\n            if (mime[1] === '\u003C/em>')\n            {\n                // Every mime-type that begins with mime[0] now needs to be pushed into the mimes array\n                for (var j=0, jlen = fileTypes.length; j \u003C jlen; j++)\n                {\n                    var fileType = fileTypes[j].split(///);\n                    if (mime[0] === fileType[0]) mimes.push(fileTypes[j]);\n                }\n            } else {\n                // Pass the mime type through unmolested\n                mimes.push(mime.join('/'));\n            }\n        } else {\n            // Only an extension has been specified - map to the mime type\n            if (mime[0] in filters) mimes.push(filters[mime[0]]);\n        }\n    }\n    return mimes;\n};\n",[19055],{"type":20,"tag":68,"props":19056,"children":19057},{"__ignoreMap":8},[19058,19065,19073,19081,19089,19097,19105,19127,19135,19182,19201,19209,19259,19266,19307,19314,19378,19385,19428,19457,19464,19502,19509,19517,19582,19590,19624,19672,19679,19687,19695,19713,19720,19728,19736,19744,19751,19758,19766],{"type":20,"tag":194,"props":19059,"children":19060},{"class":196,"line":197},[19061],{"type":20,"tag":194,"props":19062,"children":19063},{"style":201},[19064],{"type":30,"value":1264},{"type":20,"tag":194,"props":19066,"children":19067},{"class":196,"line":207},[19068],{"type":20,"tag":194,"props":19069,"children":19070},{"style":201},[19071],{"type":30,"value":19072},"* Translate the accept string or array into an array of mime types, based on the mime types in filters.\n",{"type":20,"tag":194,"props":19074,"children":19075},{"class":196,"line":216},[19076],{"type":20,"tag":194,"props":19077,"children":19078},{"style":201},[19079],{"type":30,"value":19080},"* Input should look like the expected extensions:\n",{"type":20,"tag":194,"props":19082,"children":19083},{"class":196,"line":225},[19084],{"type":20,"tag":194,"props":19085,"children":19086},{"style":201},[19087],{"type":30,"value":19088},"* \"swf, wmv, mp4\" or ['swf', 'wmv', 'mp4']\n",{"type":20,"tag":194,"props":19090,"children":19091},{"class":196,"line":234},[19092],{"type":20,"tag":194,"props":19093,"children":19094},{"style":201},[19095],{"type":30,"value":19096},"* Or like mime type categories, or the mime types themselves:\n",{"type":20,"tag":194,"props":19098,"children":19099},{"class":196,"line":243},[19100],{"type":20,"tag":194,"props":19101,"children":19102},{"style":201},[19103],{"type":30,"value":19104},"* \"application/*, application/pdf\" or ['image/\u003Cem>', 'plain/text']\n",{"type":20,"tag":194,"props":19106,"children":19107},{"class":196,"line":275},[19108,19113,19117,19122],{"type":20,"tag":194,"props":19109,"children":19110},{"style":201},[19111],{"type":30,"value":19112},"* ",{"type":20,"tag":194,"props":19114,"children":19115},{"style":252},[19116],{"type":30,"value":255},{"type":20,"tag":194,"props":19118,"children":19119},{"style":258},[19120],{"type":30,"value":19121}," {array|string}",{"type":20,"tag":194,"props":19123,"children":19124},{"style":264},[19125],{"type":30,"value":19126}," accept\n",{"type":20,"tag":194,"props":19128,"children":19129},{"class":196,"line":284},[19130],{"type":20,"tag":194,"props":19131,"children":19132},{"style":201},[19133],{"type":30,"value":19134},"*/\n",{"type":20,"tag":194,"props":19136,"children":19137},{"class":196,"line":311},[19138,19143,19147,19152,19156,19161,19165,19169,19173,19178],{"type":20,"tag":194,"props":19139,"children":19140},{"style":680},[19141],{"type":30,"value":19142},"Hup",{"type":20,"tag":194,"props":19144,"children":19145},{"style":264},[19146],{"type":30,"value":55},{"type":20,"tag":194,"props":19148,"children":19149},{"style":680},[19150],{"type":30,"value":19151},"prototype",{"type":20,"tag":194,"props":19153,"children":19154},{"style":264},[19155],{"type":30,"value":55},{"type":20,"tag":194,"props":19157,"children":19158},{"style":258},[19159],{"type":30,"value":19160},"acceptFilters",{"type":20,"tag":194,"props":19162,"children":19163},{"style":252},[19164],{"type":30,"value":3298},{"type":20,"tag":194,"props":19166,"children":19167},{"style":252},[19168],{"type":30,"value":3303},{"type":20,"tag":194,"props":19170,"children":19171},{"style":264},[19172],{"type":30,"value":403},{"type":20,"tag":194,"props":19174,"children":19175},{"style":406},[19176],{"type":30,"value":19177},"accept",{"type":20,"tag":194,"props":19179,"children":19180},{"style":264},[19181],{"type":30,"value":4253},{"type":20,"tag":194,"props":19183,"children":19184},{"class":196,"line":320},[19185,19189,19193,19197],{"type":20,"tag":194,"props":19186,"children":19187},{"style":252},[19188],{"type":30,"value":451},{"type":20,"tag":194,"props":19190,"children":19191},{"style":264},[19192],{"type":30,"value":18602},{"type":20,"tag":194,"props":19194,"children":19195},{"style":252},[19196],{"type":30,"value":461},{"type":20,"tag":194,"props":19198,"children":19199},{"style":264},[19200],{"type":30,"value":18536},{"type":20,"tag":194,"props":19202,"children":19203},{"class":196,"line":347},[19204],{"type":20,"tag":194,"props":19205,"children":19206},{"style":201},[19207],{"type":30,"value":19208},"    // Ensure accept is an array of extensions or mime types\n",{"type":20,"tag":194,"props":19210,"children":19211},{"class":196,"line":356},[19212,19216,19220,19224,19229,19233,19238,19242,19246,19250,19255],{"type":20,"tag":194,"props":19213,"children":19214},{"style":252},[19215],{"type":30,"value":1360},{"type":20,"tag":194,"props":19217,"children":19218},{"style":264},[19219],{"type":30,"value":1172},{"type":20,"tag":194,"props":19221,"children":19222},{"style":252},[19223],{"type":30,"value":1861},{"type":20,"tag":194,"props":19225,"children":19226},{"style":264},[19227],{"type":30,"value":19228}," accept ",{"type":20,"tag":194,"props":19230,"children":19231},{"style":252},[19232],{"type":30,"value":1826},{"type":20,"tag":194,"props":19234,"children":19235},{"style":506},[19236],{"type":30,"value":19237}," 'string'",{"type":20,"tag":194,"props":19239,"children":19240},{"style":252},[19241],{"type":30,"value":5181},{"type":20,"tag":194,"props":19243,"children":19244},{"style":264},[19245],{"type":30,"value":19228},{"type":20,"tag":194,"props":19247,"children":19248},{"style":252},[19249],{"type":30,"value":17460},{"type":20,"tag":194,"props":19251,"children":19252},{"style":258},[19253],{"type":30,"value":19254}," String",{"type":20,"tag":194,"props":19256,"children":19257},{"style":264},[19258],{"type":30,"value":5702},{"type":20,"tag":194,"props":19260,"children":19261},{"class":196,"line":378},[19262],{"type":20,"tag":194,"props":19263,"children":19264},{"style":264},[19265],{"type":30,"value":18735},{"type":20,"tag":194,"props":19267,"children":19268},{"class":196,"line":387},[19269,19274,19278,19283,19287,19291,19295,19299,19303],{"type":20,"tag":194,"props":19270,"children":19271},{"style":264},[19272],{"type":30,"value":19273},"        accept ",{"type":20,"tag":194,"props":19275,"children":19276},{"style":252},[19277],{"type":30,"value":461},{"type":20,"tag":194,"props":19279,"children":19280},{"style":264},[19281],{"type":30,"value":19282}," accept.",{"type":20,"tag":194,"props":19284,"children":19285},{"style":258},[19286],{"type":30,"value":18616},{"type":20,"tag":194,"props":19288,"children":19289},{"style":264},[19290],{"type":30,"value":403},{"type":20,"tag":194,"props":19292,"children":19293},{"style":506},[19294],{"type":30,"value":12085},{"type":20,"tag":194,"props":19296,"children":19297},{"style":12088},[19298],{"type":30,"value":18629},{"type":20,"tag":194,"props":19300,"children":19301},{"style":506},[19302],{"type":30,"value":12085},{"type":20,"tag":194,"props":19304,"children":19305},{"style":264},[19306],{"type":30,"value":1649},{"type":20,"tag":194,"props":19308,"children":19309},{"class":196,"line":445},[19310],{"type":20,"tag":194,"props":19311,"children":19312},{"style":264},[19313],{"type":30,"value":1657},{"type":20,"tag":194,"props":19315,"children":19316},{"class":196,"line":479},[19317,19321,19325,19329,19333,19337,19341,19346,19350,19354,19358,19362,19366,19370,19374],{"type":20,"tag":194,"props":19318,"children":19319},{"style":252},[19320],{"type":30,"value":18661},{"type":20,"tag":194,"props":19322,"children":19323},{"style":264},[19324],{"type":30,"value":1172},{"type":20,"tag":194,"props":19326,"children":19327},{"style":252},[19328],{"type":30,"value":4057},{"type":20,"tag":194,"props":19330,"children":19331},{"style":264},[19332],{"type":30,"value":18674},{"type":20,"tag":194,"props":19334,"children":19335},{"style":252},[19336],{"type":30,"value":461},{"type":20,"tag":194,"props":19338,"children":19339},{"style":680},[19340],{"type":30,"value":6487},{"type":20,"tag":194,"props":19342,"children":19343},{"style":264},[19344],{"type":30,"value":19345},", len ",{"type":20,"tag":194,"props":19347,"children":19348},{"style":252},[19349],{"type":30,"value":461},{"type":20,"tag":194,"props":19351,"children":19352},{"style":264},[19353],{"type":30,"value":19282},{"type":20,"tag":194,"props":19355,"children":19356},{"style":680},[19357],{"type":30,"value":17741},{"type":20,"tag":194,"props":19359,"children":19360},{"style":264},[19361],{"type":30,"value":18705},{"type":20,"tag":194,"props":19363,"children":19364},{"style":252},[19365],{"type":30,"value":3674},{"type":20,"tag":194,"props":19367,"children":19368},{"style":264},[19369],{"type":30,"value":18714},{"type":20,"tag":194,"props":19371,"children":19372},{"style":252},[19373],{"type":30,"value":18869},{"type":20,"tag":194,"props":19375,"children":19376},{"style":264},[19377],{"type":30,"value":5702},{"type":20,"tag":194,"props":19379,"children":19380},{"class":196,"line":542},[19381],{"type":20,"tag":194,"props":19382,"children":19383},{"style":264},[19384],{"type":30,"value":18735},{"type":20,"tag":194,"props":19386,"children":19387},{"class":196,"line":552},[19388,19392,19397,19401,19406,19411,19415,19419,19423],{"type":20,"tag":194,"props":19389,"children":19390},{"style":252},[19391],{"type":30,"value":1491},{"type":20,"tag":194,"props":19393,"children":19394},{"style":264},[19395],{"type":30,"value":19396}," mime ",{"type":20,"tag":194,"props":19398,"children":19399},{"style":252},[19400],{"type":30,"value":461},{"type":20,"tag":194,"props":19402,"children":19403},{"style":264},[19404],{"type":30,"value":19405}," accept[i].",{"type":20,"tag":194,"props":19407,"children":19408},{"style":258},[19409],{"type":30,"value":19410},"trim",{"type":20,"tag":194,"props":19412,"children":19413},{"style":264},[19414],{"type":30,"value":567},{"type":20,"tag":194,"props":19416,"children":19417},{"style":258},[19418],{"type":30,"value":18616},{"type":20,"tag":194,"props":19420,"children":19421},{"style":264},[19422],{"type":30,"value":403},{"type":20,"tag":194,"props":19424,"children":19425},{"style":201},[19426],{"type":30,"value":19427},"///);\n",{"type":20,"tag":194,"props":19429,"children":19430},{"class":196,"line":598},[19431,19435,19440,19444,19449,19453],{"type":20,"tag":194,"props":19432,"children":19433},{"style":258},[19434],{"type":30,"value":1782},{"type":20,"tag":194,"props":19436,"children":19437},{"style":264},[19438],{"type":30,"value":19439}," (mime.",{"type":20,"tag":194,"props":19441,"children":19442},{"style":680},[19443],{"type":30,"value":17741},{"type":20,"tag":194,"props":19445,"children":19446},{"style":252},[19447],{"type":30,"value":19448}," >",{"type":20,"tag":194,"props":19450,"children":19451},{"style":680},[19452],{"type":30,"value":15768},{"type":20,"tag":194,"props":19454,"children":19455},{"style":264},[19456],{"type":30,"value":5702},{"type":20,"tag":194,"props":19458,"children":19459},{"class":196,"line":611},[19460],{"type":20,"tag":194,"props":19461,"children":19462},{"style":264},[19463],{"type":30,"value":1057},{"type":20,"tag":194,"props":19465,"children":19466},{"class":196,"line":630},[19467,19471,19475,19480,19484,19488,19493,19498],{"type":20,"tag":194,"props":19468,"children":19469},{"style":258},[19470],{"type":30,"value":13826},{"type":20,"tag":194,"props":19472,"children":19473},{"style":264},[19474],{"type":30,"value":1172},{"type":20,"tag":194,"props":19476,"children":19477},{"style":406},[19478],{"type":30,"value":19479},"mime",{"type":20,"tag":194,"props":19481,"children":19482},{"style":264},[19483],{"type":30,"value":12203},{"type":20,"tag":194,"props":19485,"children":19486},{"style":680},[19487],{"type":30,"value":9401},{"type":20,"tag":194,"props":19489,"children":19490},{"style":264},[19491],{"type":30,"value":19492},"] === ",{"type":20,"tag":194,"props":19494,"children":19495},{"style":506},[19496],{"type":30,"value":19497},"'\u003C/em>'",{"type":20,"tag":194,"props":19499,"children":19500},{"style":264},[19501],{"type":30,"value":5702},{"type":20,"tag":194,"props":19503,"children":19504},{"class":196,"line":713},[19505],{"type":20,"tag":194,"props":19506,"children":19507},{"style":264},[19508],{"type":30,"value":2983},{"type":20,"tag":194,"props":19510,"children":19511},{"class":196,"line":743},[19512],{"type":20,"tag":194,"props":19513,"children":19514},{"style":201},[19515],{"type":30,"value":19516},"                // Every mime-type that begins with mime[0] now needs to be pushed into the mimes array\n",{"type":20,"tag":194,"props":19518,"children":19519},{"class":196,"line":762},[19520,19525,19529,19533,19537,19541,19545,19549,19553,19558,19562,19566,19570,19574,19578],{"type":20,"tag":194,"props":19521,"children":19522},{"style":252},[19523],{"type":30,"value":19524},"                for",{"type":20,"tag":194,"props":19526,"children":19527},{"style":264},[19528],{"type":30,"value":1172},{"type":20,"tag":194,"props":19530,"children":19531},{"style":252},[19532],{"type":30,"value":4057},{"type":20,"tag":194,"props":19534,"children":19535},{"style":264},[19536],{"type":30,"value":18824},{"type":20,"tag":194,"props":19538,"children":19539},{"style":252},[19540],{"type":30,"value":461},{"type":20,"tag":194,"props":19542,"children":19543},{"style":680},[19544],{"type":30,"value":6487},{"type":20,"tag":194,"props":19546,"children":19547},{"style":264},[19548],{"type":30,"value":18837},{"type":20,"tag":194,"props":19550,"children":19551},{"style":252},[19552],{"type":30,"value":461},{"type":20,"tag":194,"props":19554,"children":19555},{"style":264},[19556],{"type":30,"value":19557}," fileTypes.",{"type":20,"tag":194,"props":19559,"children":19560},{"style":680},[19561],{"type":30,"value":17741},{"type":20,"tag":194,"props":19563,"children":19564},{"style":264},[19565],{"type":30,"value":18855},{"type":20,"tag":194,"props":19567,"children":19568},{"style":252},[19569],{"type":30,"value":3674},{"type":20,"tag":194,"props":19571,"children":19572},{"style":264},[19573],{"type":30,"value":18864},{"type":20,"tag":194,"props":19575,"children":19576},{"style":252},[19577],{"type":30,"value":18869},{"type":20,"tag":194,"props":19579,"children":19580},{"style":264},[19581],{"type":30,"value":5702},{"type":20,"tag":194,"props":19583,"children":19584},{"class":196,"line":771},[19585],{"type":20,"tag":194,"props":19586,"children":19587},{"style":264},[19588],{"type":30,"value":19589},"                {\n",{"type":20,"tag":194,"props":19591,"children":19592},{"class":196,"line":785},[19593,19598,19603,19607,19612,19616,19620],{"type":20,"tag":194,"props":19594,"children":19595},{"style":252},[19596],{"type":30,"value":19597},"                    var",{"type":20,"tag":194,"props":19599,"children":19600},{"style":264},[19601],{"type":30,"value":19602}," fileType ",{"type":20,"tag":194,"props":19604,"children":19605},{"style":252},[19606],{"type":30,"value":461},{"type":20,"tag":194,"props":19608,"children":19609},{"style":264},[19610],{"type":30,"value":19611}," fileTypes[j].",{"type":20,"tag":194,"props":19613,"children":19614},{"style":258},[19615],{"type":30,"value":18616},{"type":20,"tag":194,"props":19617,"children":19618},{"style":264},[19619],{"type":30,"value":403},{"type":20,"tag":194,"props":19621,"children":19622},{"style":201},[19623],{"type":30,"value":19427},{"type":20,"tag":194,"props":19625,"children":19626},{"class":196,"line":818},[19627,19631,19636,19640,19645,19649,19654,19658,19663,19667],{"type":20,"tag":194,"props":19628,"children":19629},{"style":258},[19630],{"type":30,"value":14015},{"type":20,"tag":194,"props":19632,"children":19633},{"style":264},[19634],{"type":30,"value":19635}," (mime[",{"type":20,"tag":194,"props":19637,"children":19638},{"style":680},[19639],{"type":30,"value":6487},{"type":20,"tag":194,"props":19641,"children":19642},{"style":264},[19643],{"type":30,"value":19644},"] ",{"type":20,"tag":194,"props":19646,"children":19647},{"style":252},[19648],{"type":30,"value":1826},{"type":20,"tag":194,"props":19650,"children":19651},{"style":264},[19652],{"type":30,"value":19653}," fileType[",{"type":20,"tag":194,"props":19655,"children":19656},{"style":680},[19657],{"type":30,"value":6487},{"type":20,"tag":194,"props":19659,"children":19660},{"style":264},[19661],{"type":30,"value":19662},"]) mimes.",{"type":20,"tag":194,"props":19664,"children":19665},{"style":258},[19666],{"type":30,"value":18748},{"type":20,"tag":194,"props":19668,"children":19669},{"style":264},[19670],{"type":30,"value":19671},"(fileTypes[j]);\n",{"type":20,"tag":194,"props":19673,"children":19674},{"class":196,"line":827},[19675],{"type":20,"tag":194,"props":19676,"children":19677},{"style":264},[19678],{"type":30,"value":3048},{"type":20,"tag":194,"props":19680,"children":19681},{"class":196,"line":836},[19682],{"type":20,"tag":194,"props":19683,"children":19684},{"style":264},[19685],{"type":30,"value":19686},"            } else {\n",{"type":20,"tag":194,"props":19688,"children":19689},{"class":196,"line":844},[19690],{"type":20,"tag":194,"props":19691,"children":19692},{"style":201},[19693],{"type":30,"value":19694},"                // Pass the mime type through unmolested\n",{"type":20,"tag":194,"props":19696,"children":19697},{"class":196,"line":858},[19698,19703,19708],{"type":20,"tag":194,"props":19699,"children":19700},{"style":264},[19701],{"type":30,"value":19702},"                mimes.push(mime.join(",{"type":20,"tag":194,"props":19704,"children":19705},{"style":506},[19706],{"type":30,"value":19707},"'/'",{"type":20,"tag":194,"props":19709,"children":19710},{"style":264},[19711],{"type":30,"value":19712},"));\n",{"type":20,"tag":194,"props":19714,"children":19715},{"class":196,"line":1726},[19716],{"type":20,"tag":194,"props":19717,"children":19718},{"style":264},[19719],{"type":30,"value":1121},{"type":20,"tag":194,"props":19721,"children":19722},{"class":196,"line":1743},[19723],{"type":20,"tag":194,"props":19724,"children":19725},{"style":264},[19726],{"type":30,"value":19727},"        } else {\n",{"type":20,"tag":194,"props":19729,"children":19730},{"class":196,"line":1751},[19731],{"type":20,"tag":194,"props":19732,"children":19733},{"style":201},[19734],{"type":30,"value":19735},"            // Only an extension has been specified - map to the mime type\n",{"type":20,"tag":194,"props":19737,"children":19738},{"class":196,"line":1776},[19739],{"type":20,"tag":194,"props":19740,"children":19741},{"style":264},[19742],{"type":30,"value":19743},"            if (mime[0] in filters) mimes.push(filters[mime[0]]);\n",{"type":20,"tag":194,"props":19745,"children":19746},{"class":196,"line":1811},[19747],{"type":20,"tag":194,"props":19748,"children":19749},{"style":264},[19750],{"type":30,"value":824},{"type":20,"tag":194,"props":19752,"children":19753},{"class":196,"line":1847},[19754],{"type":20,"tag":194,"props":19755,"children":19756},{"style":264},[19757],{"type":30,"value":1657},{"type":20,"tag":194,"props":19759,"children":19760},{"class":196,"line":1901},[19761],{"type":20,"tag":194,"props":19762,"children":19763},{"style":264},[19764],{"type":30,"value":19765},"    return mimes;\n",{"type":20,"tag":194,"props":19767,"children":19768},{"class":196,"line":1937},[19769],{"type":20,"tag":194,"props":19770,"children":19771},{"style":264},[19772],{"type":30,"value":19773},"};\n",{"type":20,"tag":21,"props":19775,"children":19776},{},[19777,19779,19785,19787,19793],{"type":30,"value":19778},"Here, we allow the plugin user to set accept on the plugin as either a string or an array, and generate our mimes filter array from it. This allows us to be more permissive than the standard accept filter, with: ",{"type":20,"tag":68,"props":19780,"children":19782},{"className":19781},[],[19783],{"type":30,"value":19784},"\"wmv, audio/_, swf\" or ['wmv', 'audio/_', 'swf']",{"type":30,"value":19786}," both being valid. Notice the wildcard in the above example? In acceptFilters, we split on the forward slash and if the second part is a wildcard, we add every mime-type that matches the first part to the mimes filter array. If both parts are specified (ie. 'plain/text'), we pass it through unchanged (save for trimming any whitespace) - this allows the user to add mime-types that aren't in our list (ie. video/ogg, audio/flac, etc.). These can be combined - so if you want to allow any audio type, and include ones that aren't explicit in our list, you can specify ",{"type":20,"tag":68,"props":19788,"children":19790},{"className":19789},[],[19791],{"type":30,"value":19792},"['audio/*', 'audio/flac', 'audio/alac', 'audio/ogg']",{"type":30,"value":19794}," to do just that.",{"type":20,"tag":21,"props":19796,"children":19797},{},[19798],{"type":30,"value":19799},"Finally, when we're iterating through the fileList, we make our checks against the mimetype of the file in the fileList and, if its not in our accept filter, we fire a new event of type FILE_TYPE_ERROR and continue on to the next file in the list.",{"type":20,"tag":184,"props":19801,"children":19803},{"className":186,"code":19802,"language":188,"meta":8,"style":8}," /**\n* Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n* memory and passing them on to be used in the browser.\n* @param files\n* @param upload\n*/\nHup.prototype.processFiles = function(files, upload){\n    var that = this,\n        processed = 0,\n        accept = this.options.accept,\n        accepted = false,\n        maxSize = this.options.max_file_size,\n        fprocess;\n\nfor (var i=0, len = files.length; i &lt; len; i++)\n{\n    // Check file against mime accept restrictions if any restrictions are set\n    if (accept.length)\n    {\n        accepted = false;\n        for (var j=0, jlen = accept.length; j &lt; jlen; j++)\n        {\n            accepted = (files[i].type === accept[j]);\n            if (accepted) break;\n        }\n        if (!accepted)\n        {\n            this.input.trigger(Hup.state.FILE_TYPE_ERROR,\n                {state:Hup.state.FILE_TYPE_ERROR,\n                    error:'File type is '+files[i].type+', accepted types are '+\n                        accept.join(',')+'.'});\n            continue;\n        }\n    }\n    // Check file against size restrictions\n    if (maxSize &amp;&amp; files[i].size &gt; maxSize)\n    {\n        this.input.trigger(Hup.state.FILE_SIZE_ERROR,\n            {state:Hup.state.FILE_SIZE_ERROR,\n                error:'File size is '+files[i].size+', max file size is '+maxSize+'.'});\n        continue;\n    }\n    // Create new DeferXhr or DeferReader and listen on its progression and completion to fire the appropriate\n    // events for interested listeners on our input\n    fprocess = (upload) ? new DeferXhr(this.options, files[i]) :\n        new DeferReader(this.options.read_method, files[i]);\n\n    fprocess.progress(function(progress){\n        that.input.trigger(progress.state, progress);\n    }).done(function(res){\n        that.input.trigger(res.state, res);\n        processed++;\n        if (processed &gt;= len){\n            that.input.trigger((upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL ,\n                {state:(upload) ? Hup.state.FILE_UPLOAD_ALL : Hup.state.FILE_READ_ALL, files:len});\n        }\n    }).fail(function(res)\n    {\n        that.input.trigger(res.state, res);\n    });\n}\n\n};\n",[19804],{"type":20,"tag":68,"props":19805,"children":19806},{"__ignoreMap":8},[19807,19815,19823,19831,19847,19863,19870,19923,19947,19967,19987,20007,20028,20036,20043,20110,20117,20125,20145,20152,20171,20235,20242,20268,20289,20296,20316,20323,20355,20371,20407,20447,20459,20466,20473,20481,20520,20527,20556,20572,20624,20636,20643,20651,20659,20706,20732,20739,20772,20789,20821,20837,20853,20883,20933,20970,20977,21008,21015,21030,21037,21044,21051],{"type":20,"tag":194,"props":19808,"children":19809},{"class":196,"line":197},[19810],{"type":20,"tag":194,"props":19811,"children":19812},{"style":201},[19813],{"type":30,"value":19814}," /**\n",{"type":20,"tag":194,"props":19816,"children":19817},{"class":196,"line":207},[19818],{"type":20,"tag":194,"props":19819,"children":19820},{"style":201},[19821],{"type":30,"value":19822},"* Process the files in the fileList, uploading them if a url is specified, otherwise reading them into\n",{"type":20,"tag":194,"props":19824,"children":19825},{"class":196,"line":216},[19826],{"type":20,"tag":194,"props":19827,"children":19828},{"style":201},[19829],{"type":30,"value":19830},"* memory and passing them on to be used in the browser.\n",{"type":20,"tag":194,"props":19832,"children":19833},{"class":196,"line":225},[19834,19838,19842],{"type":20,"tag":194,"props":19835,"children":19836},{"style":201},[19837],{"type":30,"value":19112},{"type":20,"tag":194,"props":19839,"children":19840},{"style":252},[19841],{"type":30,"value":255},{"type":20,"tag":194,"props":19843,"children":19844},{"style":264},[19845],{"type":30,"value":19846}," files\n",{"type":20,"tag":194,"props":19848,"children":19849},{"class":196,"line":234},[19850,19854,19858],{"type":20,"tag":194,"props":19851,"children":19852},{"style":201},[19853],{"type":30,"value":19112},{"type":20,"tag":194,"props":19855,"children":19856},{"style":252},[19857],{"type":30,"value":255},{"type":20,"tag":194,"props":19859,"children":19860},{"style":264},[19861],{"type":30,"value":19862}," upload\n",{"type":20,"tag":194,"props":19864,"children":19865},{"class":196,"line":243},[19866],{"type":20,"tag":194,"props":19867,"children":19868},{"style":201},[19869],{"type":30,"value":19134},{"type":20,"tag":194,"props":19871,"children":19872},{"class":196,"line":275},[19873,19877,19881,19885,19889,19894,19898,19902,19906,19911,19915,19919],{"type":20,"tag":194,"props":19874,"children":19875},{"style":680},[19876],{"type":30,"value":19142},{"type":20,"tag":194,"props":19878,"children":19879},{"style":264},[19880],{"type":30,"value":55},{"type":20,"tag":194,"props":19882,"children":19883},{"style":680},[19884],{"type":30,"value":19151},{"type":20,"tag":194,"props":19886,"children":19887},{"style":264},[19888],{"type":30,"value":55},{"type":20,"tag":194,"props":19890,"children":19891},{"style":258},[19892],{"type":30,"value":19893},"processFiles",{"type":20,"tag":194,"props":19895,"children":19896},{"style":252},[19897],{"type":30,"value":3298},{"type":20,"tag":194,"props":19899,"children":19900},{"style":252},[19901],{"type":30,"value":3303},{"type":20,"tag":194,"props":19903,"children":19904},{"style":264},[19905],{"type":30,"value":403},{"type":20,"tag":194,"props":19907,"children":19908},{"style":406},[19909],{"type":30,"value":19910},"files",{"type":20,"tag":194,"props":19912,"children":19913},{"style":264},[19914],{"type":30,"value":414},{"type":20,"tag":194,"props":19916,"children":19917},{"style":406},[19918],{"type":30,"value":14881},{"type":20,"tag":194,"props":19920,"children":19921},{"style":264},[19922],{"type":30,"value":4253},{"type":20,"tag":194,"props":19924,"children":19925},{"class":196,"line":284},[19926,19930,19935,19939,19943],{"type":20,"tag":194,"props":19927,"children":19928},{"style":252},[19929],{"type":30,"value":451},{"type":20,"tag":194,"props":19931,"children":19932},{"style":264},[19933],{"type":30,"value":19934}," that ",{"type":20,"tag":194,"props":19936,"children":19937},{"style":252},[19938],{"type":30,"value":461},{"type":20,"tag":194,"props":19940,"children":19941},{"style":680},[19942],{"type":30,"value":4142},{"type":20,"tag":194,"props":19944,"children":19945},{"style":264},[19946],{"type":30,"value":1075},{"type":20,"tag":194,"props":19948,"children":19949},{"class":196,"line":311},[19950,19955,19959,19963],{"type":20,"tag":194,"props":19951,"children":19952},{"style":264},[19953],{"type":30,"value":19954},"        processed ",{"type":20,"tag":194,"props":19956,"children":19957},{"style":252},[19958],{"type":30,"value":461},{"type":20,"tag":194,"props":19960,"children":19961},{"style":680},[19962],{"type":30,"value":3627},{"type":20,"tag":194,"props":19964,"children":19965},{"style":264},[19966],{"type":30,"value":1075},{"type":20,"tag":194,"props":19968,"children":19969},{"class":196,"line":320},[19970,19974,19978,19982],{"type":20,"tag":194,"props":19971,"children":19972},{"style":264},[19973],{"type":30,"value":19273},{"type":20,"tag":194,"props":19975,"children":19976},{"style":252},[19977],{"type":30,"value":461},{"type":20,"tag":194,"props":19979,"children":19980},{"style":680},[19981],{"type":30,"value":4142},{"type":20,"tag":194,"props":19983,"children":19984},{"style":264},[19985],{"type":30,"value":19986},".options.accept,\n",{"type":20,"tag":194,"props":19988,"children":19989},{"class":196,"line":347},[19990,19995,19999,20003],{"type":20,"tag":194,"props":19991,"children":19992},{"style":264},[19993],{"type":30,"value":19994},"        accepted ",{"type":20,"tag":194,"props":19996,"children":19997},{"style":252},[19998],{"type":30,"value":461},{"type":20,"tag":194,"props":20000,"children":20001},{"style":680},[20002],{"type":30,"value":1804},{"type":20,"tag":194,"props":20004,"children":20005},{"style":264},[20006],{"type":30,"value":1075},{"type":20,"tag":194,"props":20008,"children":20009},{"class":196,"line":356},[20010,20015,20019,20023],{"type":20,"tag":194,"props":20011,"children":20012},{"style":264},[20013],{"type":30,"value":20014},"        maxSize ",{"type":20,"tag":194,"props":20016,"children":20017},{"style":252},[20018],{"type":30,"value":461},{"type":20,"tag":194,"props":20020,"children":20021},{"style":680},[20022],{"type":30,"value":4142},{"type":20,"tag":194,"props":20024,"children":20025},{"style":264},[20026],{"type":30,"value":20027},".options.max_file_size,\n",{"type":20,"tag":194,"props":20029,"children":20030},{"class":196,"line":378},[20031],{"type":20,"tag":194,"props":20032,"children":20033},{"style":264},[20034],{"type":30,"value":20035},"        fprocess;\n",{"type":20,"tag":194,"props":20037,"children":20038},{"class":196,"line":387},[20039],{"type":20,"tag":194,"props":20040,"children":20041},{"emptyLinePlaceholder":546},[20042],{"type":30,"value":549},{"type":20,"tag":194,"props":20044,"children":20045},{"class":196,"line":445},[20046,20051,20055,20059,20063,20067,20071,20075,20079,20084,20088,20092,20097,20102,20106],{"type":20,"tag":194,"props":20047,"children":20048},{"style":252},[20049],{"type":30,"value":20050},"for",{"type":20,"tag":194,"props":20052,"children":20053},{"style":264},[20054],{"type":30,"value":1172},{"type":20,"tag":194,"props":20056,"children":20057},{"style":252},[20058],{"type":30,"value":4057},{"type":20,"tag":194,"props":20060,"children":20061},{"style":264},[20062],{"type":30,"value":18674},{"type":20,"tag":194,"props":20064,"children":20065},{"style":252},[20066],{"type":30,"value":461},{"type":20,"tag":194,"props":20068,"children":20069},{"style":680},[20070],{"type":30,"value":6487},{"type":20,"tag":194,"props":20072,"children":20073},{"style":264},[20074],{"type":30,"value":19345},{"type":20,"tag":194,"props":20076,"children":20077},{"style":252},[20078],{"type":30,"value":461},{"type":20,"tag":194,"props":20080,"children":20081},{"style":264},[20082],{"type":30,"value":20083}," files.",{"type":20,"tag":194,"props":20085,"children":20086},{"style":680},[20087],{"type":30,"value":17741},{"type":20,"tag":194,"props":20089,"children":20090},{"style":264},[20091],{"type":30,"value":18705},{"type":20,"tag":194,"props":20093,"children":20094},{"style":252},[20095],{"type":30,"value":20096},"&",{"type":20,"tag":194,"props":20098,"children":20099},{"style":264},[20100],{"type":30,"value":20101},"lt; len; i",{"type":20,"tag":194,"props":20103,"children":20104},{"style":252},[20105],{"type":30,"value":18869},{"type":20,"tag":194,"props":20107,"children":20108},{"style":264},[20109],{"type":30,"value":5702},{"type":20,"tag":194,"props":20111,"children":20112},{"class":196,"line":479},[20113],{"type":20,"tag":194,"props":20114,"children":20115},{"style":264},[20116],{"type":30,"value":13056},{"type":20,"tag":194,"props":20118,"children":20119},{"class":196,"line":542},[20120],{"type":20,"tag":194,"props":20121,"children":20122},{"style":201},[20123],{"type":30,"value":20124},"    // Check file against mime accept restrictions if any restrictions are set\n",{"type":20,"tag":194,"props":20126,"children":20127},{"class":196,"line":552},[20128,20132,20137,20141],{"type":20,"tag":194,"props":20129,"children":20130},{"style":252},[20131],{"type":30,"value":1360},{"type":20,"tag":194,"props":20133,"children":20134},{"style":264},[20135],{"type":30,"value":20136}," (accept.",{"type":20,"tag":194,"props":20138,"children":20139},{"style":680},[20140],{"type":30,"value":17741},{"type":20,"tag":194,"props":20142,"children":20143},{"style":264},[20144],{"type":30,"value":5702},{"type":20,"tag":194,"props":20146,"children":20147},{"class":196,"line":598},[20148],{"type":20,"tag":194,"props":20149,"children":20150},{"style":264},[20151],{"type":30,"value":18735},{"type":20,"tag":194,"props":20153,"children":20154},{"class":196,"line":611},[20155,20159,20163,20167],{"type":20,"tag":194,"props":20156,"children":20157},{"style":264},[20158],{"type":30,"value":19994},{"type":20,"tag":194,"props":20160,"children":20161},{"style":252},[20162],{"type":30,"value":461},{"type":20,"tag":194,"props":20164,"children":20165},{"style":680},[20166],{"type":30,"value":1804},{"type":20,"tag":194,"props":20168,"children":20169},{"style":264},[20170],{"type":30,"value":1384},{"type":20,"tag":194,"props":20172,"children":20173},{"class":196,"line":630},[20174,20178,20182,20186,20190,20194,20198,20202,20206,20210,20214,20218,20222,20227,20231],{"type":20,"tag":194,"props":20175,"children":20176},{"style":252},[20177],{"type":30,"value":18811},{"type":20,"tag":194,"props":20179,"children":20180},{"style":264},[20181],{"type":30,"value":1172},{"type":20,"tag":194,"props":20183,"children":20184},{"style":252},[20185],{"type":30,"value":4057},{"type":20,"tag":194,"props":20187,"children":20188},{"style":264},[20189],{"type":30,"value":18824},{"type":20,"tag":194,"props":20191,"children":20192},{"style":252},[20193],{"type":30,"value":461},{"type":20,"tag":194,"props":20195,"children":20196},{"style":680},[20197],{"type":30,"value":6487},{"type":20,"tag":194,"props":20199,"children":20200},{"style":264},[20201],{"type":30,"value":18837},{"type":20,"tag":194,"props":20203,"children":20204},{"style":252},[20205],{"type":30,"value":461},{"type":20,"tag":194,"props":20207,"children":20208},{"style":264},[20209],{"type":30,"value":19282},{"type":20,"tag":194,"props":20211,"children":20212},{"style":680},[20213],{"type":30,"value":17741},{"type":20,"tag":194,"props":20215,"children":20216},{"style":264},[20217],{"type":30,"value":18855},{"type":20,"tag":194,"props":20219,"children":20220},{"style":252},[20221],{"type":30,"value":20096},{"type":20,"tag":194,"props":20223,"children":20224},{"style":264},[20225],{"type":30,"value":20226},"lt; jlen; j",{"type":20,"tag":194,"props":20228,"children":20229},{"style":252},[20230],{"type":30,"value":18869},{"type":20,"tag":194,"props":20232,"children":20233},{"style":264},[20234],{"type":30,"value":5702},{"type":20,"tag":194,"props":20236,"children":20237},{"class":196,"line":713},[20238],{"type":20,"tag":194,"props":20239,"children":20240},{"style":264},[20241],{"type":30,"value":1057},{"type":20,"tag":194,"props":20243,"children":20244},{"class":196,"line":743},[20245,20250,20254,20259,20263],{"type":20,"tag":194,"props":20246,"children":20247},{"style":264},[20248],{"type":30,"value":20249},"            accepted ",{"type":20,"tag":194,"props":20251,"children":20252},{"style":252},[20253],{"type":30,"value":461},{"type":20,"tag":194,"props":20255,"children":20256},{"style":264},[20257],{"type":30,"value":20258}," (files[i].type ",{"type":20,"tag":194,"props":20260,"children":20261},{"style":252},[20262],{"type":30,"value":1826},{"type":20,"tag":194,"props":20264,"children":20265},{"style":264},[20266],{"type":30,"value":20267}," accept[j]);\n",{"type":20,"tag":194,"props":20269,"children":20270},{"class":196,"line":762},[20271,20275,20280,20285],{"type":20,"tag":194,"props":20272,"children":20273},{"style":252},[20274],{"type":30,"value":13826},{"type":20,"tag":194,"props":20276,"children":20277},{"style":264},[20278],{"type":30,"value":20279}," (accepted) ",{"type":20,"tag":194,"props":20281,"children":20282},{"style":252},[20283],{"type":30,"value":20284},"break",{"type":20,"tag":194,"props":20286,"children":20287},{"style":264},[20288],{"type":30,"value":1384},{"type":20,"tag":194,"props":20290,"children":20291},{"class":196,"line":771},[20292],{"type":20,"tag":194,"props":20293,"children":20294},{"style":264},[20295],{"type":30,"value":824},{"type":20,"tag":194,"props":20297,"children":20298},{"class":196,"line":785},[20299,20303,20307,20311],{"type":20,"tag":194,"props":20300,"children":20301},{"style":252},[20302],{"type":30,"value":1782},{"type":20,"tag":194,"props":20304,"children":20305},{"style":264},[20306],{"type":30,"value":1172},{"type":20,"tag":194,"props":20308,"children":20309},{"style":252},[20310],{"type":30,"value":1369},{"type":20,"tag":194,"props":20312,"children":20313},{"style":264},[20314],{"type":30,"value":20315},"accepted)\n",{"type":20,"tag":194,"props":20317,"children":20318},{"class":196,"line":818},[20319],{"type":20,"tag":194,"props":20320,"children":20321},{"style":264},[20322],{"type":30,"value":1057},{"type":20,"tag":194,"props":20324,"children":20325},{"class":196,"line":827},[20326,20331,20336,20341,20346,20351],{"type":20,"tag":194,"props":20327,"children":20328},{"style":680},[20329],{"type":30,"value":20330},"            this",{"type":20,"tag":194,"props":20332,"children":20333},{"style":264},[20334],{"type":30,"value":20335},".input.",{"type":20,"tag":194,"props":20337,"children":20338},{"style":258},[20339],{"type":30,"value":20340},"trigger",{"type":20,"tag":194,"props":20342,"children":20343},{"style":264},[20344],{"type":30,"value":20345},"(Hup.state.",{"type":20,"tag":194,"props":20347,"children":20348},{"style":680},[20349],{"type":30,"value":20350},"FILE_TYPE_ERROR",{"type":20,"tag":194,"props":20352,"children":20353},{"style":264},[20354],{"type":30,"value":1075},{"type":20,"tag":194,"props":20356,"children":20357},{"class":196,"line":836},[20358,20363,20367],{"type":20,"tag":194,"props":20359,"children":20360},{"style":264},[20361],{"type":30,"value":20362},"                {state:Hup.state.",{"type":20,"tag":194,"props":20364,"children":20365},{"style":680},[20366],{"type":30,"value":20350},{"type":20,"tag":194,"props":20368,"children":20369},{"style":264},[20370],{"type":30,"value":1075},{"type":20,"tag":194,"props":20372,"children":20373},{"class":196,"line":844},[20374,20379,20384,20388,20393,20397,20402],{"type":20,"tag":194,"props":20375,"children":20376},{"style":264},[20377],{"type":30,"value":20378},"                    error:",{"type":20,"tag":194,"props":20380,"children":20381},{"style":506},[20382],{"type":30,"value":20383},"'File type is '",{"type":20,"tag":194,"props":20385,"children":20386},{"style":252},[20387],{"type":30,"value":649},{"type":20,"tag":194,"props":20389,"children":20390},{"style":264},[20391],{"type":30,"value":20392},"files[i].type",{"type":20,"tag":194,"props":20394,"children":20395},{"style":252},[20396],{"type":30,"value":649},{"type":20,"tag":194,"props":20398,"children":20399},{"style":506},[20400],{"type":30,"value":20401},"', accepted types are '",{"type":20,"tag":194,"props":20403,"children":20404},{"style":252},[20405],{"type":30,"value":20406},"+\n",{"type":20,"tag":194,"props":20408,"children":20409},{"class":196,"line":858},[20410,20415,20420,20424,20429,20434,20438,20443],{"type":20,"tag":194,"props":20411,"children":20412},{"style":264},[20413],{"type":30,"value":20414},"                        accept.",{"type":20,"tag":194,"props":20416,"children":20417},{"style":258},[20418],{"type":30,"value":20419},"join",{"type":20,"tag":194,"props":20421,"children":20422},{"style":264},[20423],{"type":30,"value":403},{"type":20,"tag":194,"props":20425,"children":20426},{"style":506},[20427],{"type":30,"value":20428},"','",{"type":20,"tag":194,"props":20430,"children":20431},{"style":264},[20432],{"type":30,"value":20433},")",{"type":20,"tag":194,"props":20435,"children":20436},{"style":252},[20437],{"type":30,"value":649},{"type":20,"tag":194,"props":20439,"children":20440},{"style":506},[20441],{"type":30,"value":20442},"'.'",{"type":20,"tag":194,"props":20444,"children":20445},{"style":264},[20446],{"type":30,"value":4204},{"type":20,"tag":194,"props":20448,"children":20449},{"class":196,"line":1726},[20450,20455],{"type":20,"tag":194,"props":20451,"children":20452},{"style":252},[20453],{"type":30,"value":20454},"            continue",{"type":20,"tag":194,"props":20456,"children":20457},{"style":264},[20458],{"type":30,"value":1384},{"type":20,"tag":194,"props":20460,"children":20461},{"class":196,"line":1743},[20462],{"type":20,"tag":194,"props":20463,"children":20464},{"style":264},[20465],{"type":30,"value":824},{"type":20,"tag":194,"props":20467,"children":20468},{"class":196,"line":1751},[20469],{"type":20,"tag":194,"props":20470,"children":20471},{"style":264},[20472],{"type":30,"value":1657},{"type":20,"tag":194,"props":20474,"children":20475},{"class":196,"line":1776},[20476],{"type":20,"tag":194,"props":20477,"children":20478},{"style":201},[20479],{"type":30,"value":20480},"    // Check file against size restrictions\n",{"type":20,"tag":194,"props":20482,"children":20483},{"class":196,"line":1811},[20484,20488,20493,20497,20502,20506,20511,20515],{"type":20,"tag":194,"props":20485,"children":20486},{"style":252},[20487],{"type":30,"value":1360},{"type":20,"tag":194,"props":20489,"children":20490},{"style":264},[20491],{"type":30,"value":20492}," (maxSize ",{"type":20,"tag":194,"props":20494,"children":20495},{"style":252},[20496],{"type":30,"value":20096},{"type":20,"tag":194,"props":20498,"children":20499},{"style":264},[20500],{"type":30,"value":20501},"amp;",{"type":20,"tag":194,"props":20503,"children":20504},{"style":252},[20505],{"type":30,"value":20096},{"type":20,"tag":194,"props":20507,"children":20508},{"style":264},[20509],{"type":30,"value":20510},"amp; files[i].size ",{"type":20,"tag":194,"props":20512,"children":20513},{"style":252},[20514],{"type":30,"value":20096},{"type":20,"tag":194,"props":20516,"children":20517},{"style":264},[20518],{"type":30,"value":20519},"gt; maxSize)\n",{"type":20,"tag":194,"props":20521,"children":20522},{"class":196,"line":1847},[20523],{"type":20,"tag":194,"props":20524,"children":20525},{"style":264},[20526],{"type":30,"value":18735},{"type":20,"tag":194,"props":20528,"children":20529},{"class":196,"line":1901},[20530,20535,20539,20543,20547,20552],{"type":20,"tag":194,"props":20531,"children":20532},{"style":680},[20533],{"type":30,"value":20534},"        this",{"type":20,"tag":194,"props":20536,"children":20537},{"style":264},[20538],{"type":30,"value":20335},{"type":20,"tag":194,"props":20540,"children":20541},{"style":258},[20542],{"type":30,"value":20340},{"type":20,"tag":194,"props":20544,"children":20545},{"style":264},[20546],{"type":30,"value":20345},{"type":20,"tag":194,"props":20548,"children":20549},{"style":680},[20550],{"type":30,"value":20551},"FILE_SIZE_ERROR",{"type":20,"tag":194,"props":20553,"children":20554},{"style":264},[20555],{"type":30,"value":1075},{"type":20,"tag":194,"props":20557,"children":20558},{"class":196,"line":1937},[20559,20564,20568],{"type":20,"tag":194,"props":20560,"children":20561},{"style":264},[20562],{"type":30,"value":20563},"            {state:Hup.state.",{"type":20,"tag":194,"props":20565,"children":20566},{"style":680},[20567],{"type":30,"value":20551},{"type":20,"tag":194,"props":20569,"children":20570},{"style":264},[20571],{"type":30,"value":1075},{"type":20,"tag":194,"props":20573,"children":20574},{"class":196,"line":1951},[20575,20580,20585,20589,20594,20598,20603,20607,20612,20616,20620],{"type":20,"tag":194,"props":20576,"children":20577},{"style":264},[20578],{"type":30,"value":20579},"                error:",{"type":20,"tag":194,"props":20581,"children":20582},{"style":506},[20583],{"type":30,"value":20584},"'File size is '",{"type":20,"tag":194,"props":20586,"children":20587},{"style":252},[20588],{"type":30,"value":649},{"type":20,"tag":194,"props":20590,"children":20591},{"style":264},[20592],{"type":30,"value":20593},"files[i].size",{"type":20,"tag":194,"props":20595,"children":20596},{"style":252},[20597],{"type":30,"value":649},{"type":20,"tag":194,"props":20599,"children":20600},{"style":506},[20601],{"type":30,"value":20602},"', max file size is '",{"type":20,"tag":194,"props":20604,"children":20605},{"style":252},[20606],{"type":30,"value":649},{"type":20,"tag":194,"props":20608,"children":20609},{"style":264},[20610],{"type":30,"value":20611},"maxSize",{"type":20,"tag":194,"props":20613,"children":20614},{"style":252},[20615],{"type":30,"value":649},{"type":20,"tag":194,"props":20617,"children":20618},{"style":506},[20619],{"type":30,"value":20442},{"type":20,"tag":194,"props":20621,"children":20622},{"style":264},[20623],{"type":30,"value":4204},{"type":20,"tag":194,"props":20625,"children":20626},{"class":196,"line":1959},[20627,20632],{"type":20,"tag":194,"props":20628,"children":20629},{"style":252},[20630],{"type":30,"value":20631},"        continue",{"type":20,"tag":194,"props":20633,"children":20634},{"style":264},[20635],{"type":30,"value":1384},{"type":20,"tag":194,"props":20637,"children":20638},{"class":196,"line":1991},[20639],{"type":20,"tag":194,"props":20640,"children":20641},{"style":264},[20642],{"type":30,"value":1657},{"type":20,"tag":194,"props":20644,"children":20645},{"class":196,"line":2004},[20646],{"type":20,"tag":194,"props":20647,"children":20648},{"style":201},[20649],{"type":30,"value":20650},"    // Create new DeferXhr or DeferReader and listen on its progression and completion to fire the appropriate\n",{"type":20,"tag":194,"props":20652,"children":20653},{"class":196,"line":2012},[20654],{"type":20,"tag":194,"props":20655,"children":20656},{"style":201},[20657],{"type":30,"value":20658},"    // events for interested listeners on our input\n",{"type":20,"tag":194,"props":20660,"children":20661},{"class":196,"line":2020},[20662,20667,20671,20676,20680,20684,20689,20693,20697,20702],{"type":20,"tag":194,"props":20663,"children":20664},{"style":264},[20665],{"type":30,"value":20666},"    fprocess ",{"type":20,"tag":194,"props":20668,"children":20669},{"style":252},[20670],{"type":30,"value":461},{"type":20,"tag":194,"props":20672,"children":20673},{"style":264},[20674],{"type":30,"value":20675}," (upload) ",{"type":20,"tag":194,"props":20677,"children":20678},{"style":252},[20679],{"type":30,"value":1544},{"type":20,"tag":194,"props":20681,"children":20682},{"style":252},[20683],{"type":30,"value":1031},{"type":20,"tag":194,"props":20685,"children":20686},{"style":258},[20687],{"type":30,"value":20688}," DeferXhr",{"type":20,"tag":194,"props":20690,"children":20691},{"style":264},[20692],{"type":30,"value":403},{"type":20,"tag":194,"props":20694,"children":20695},{"style":680},[20696],{"type":30,"value":4174},{"type":20,"tag":194,"props":20698,"children":20699},{"style":264},[20700],{"type":30,"value":20701},".options, files[i]) ",{"type":20,"tag":194,"props":20703,"children":20704},{"style":252},[20705],{"type":30,"value":5867},{"type":20,"tag":194,"props":20707,"children":20708},{"class":196,"line":2028},[20709,20714,20719,20723,20727],{"type":20,"tag":194,"props":20710,"children":20711},{"style":252},[20712],{"type":30,"value":20713},"        new",{"type":20,"tag":194,"props":20715,"children":20716},{"style":258},[20717],{"type":30,"value":20718}," DeferReader",{"type":20,"tag":194,"props":20720,"children":20721},{"style":264},[20722],{"type":30,"value":403},{"type":20,"tag":194,"props":20724,"children":20725},{"style":680},[20726],{"type":30,"value":4174},{"type":20,"tag":194,"props":20728,"children":20729},{"style":264},[20730],{"type":30,"value":20731},".options.read_method, files[i]);\n",{"type":20,"tag":194,"props":20733,"children":20734},{"class":196,"line":2037},[20735],{"type":20,"tag":194,"props":20736,"children":20737},{"emptyLinePlaceholder":546},[20738],{"type":30,"value":549},{"type":20,"tag":194,"props":20740,"children":20741},{"class":196,"line":2045},[20742,20747,20752,20756,20760,20764,20768],{"type":20,"tag":194,"props":20743,"children":20744},{"style":264},[20745],{"type":30,"value":20746},"    fprocess.",{"type":20,"tag":194,"props":20748,"children":20749},{"style":258},[20750],{"type":30,"value":20751},"progress",{"type":20,"tag":194,"props":20753,"children":20754},{"style":264},[20755],{"type":30,"value":403},{"type":20,"tag":194,"props":20757,"children":20758},{"style":252},[20759],{"type":30,"value":393},{"type":20,"tag":194,"props":20761,"children":20762},{"style":264},[20763],{"type":30,"value":403},{"type":20,"tag":194,"props":20765,"children":20766},{"style":406},[20767],{"type":30,"value":20751},{"type":20,"tag":194,"props":20769,"children":20770},{"style":264},[20771],{"type":30,"value":4253},{"type":20,"tag":194,"props":20773,"children":20774},{"class":196,"line":2066},[20775,20780,20784],{"type":20,"tag":194,"props":20776,"children":20777},{"style":264},[20778],{"type":30,"value":20779},"        that.input.",{"type":20,"tag":194,"props":20781,"children":20782},{"style":258},[20783],{"type":30,"value":20340},{"type":20,"tag":194,"props":20785,"children":20786},{"style":264},[20787],{"type":30,"value":20788},"(progress.state, progress);\n",{"type":20,"tag":194,"props":20790,"children":20791},{"class":196,"line":2087},[20792,20797,20801,20805,20809,20813,20817],{"type":20,"tag":194,"props":20793,"children":20794},{"style":264},[20795],{"type":30,"value":20796},"    }).",{"type":20,"tag":194,"props":20798,"children":20799},{"style":258},[20800],{"type":30,"value":4496},{"type":20,"tag":194,"props":20802,"children":20803},{"style":264},[20804],{"type":30,"value":403},{"type":20,"tag":194,"props":20806,"children":20807},{"style":252},[20808],{"type":30,"value":393},{"type":20,"tag":194,"props":20810,"children":20811},{"style":264},[20812],{"type":30,"value":403},{"type":20,"tag":194,"props":20814,"children":20815},{"style":406},[20816],{"type":30,"value":6424},{"type":20,"tag":194,"props":20818,"children":20819},{"style":264},[20820],{"type":30,"value":4253},{"type":20,"tag":194,"props":20822,"children":20823},{"class":196,"line":2095},[20824,20828,20832],{"type":20,"tag":194,"props":20825,"children":20826},{"style":264},[20827],{"type":30,"value":20779},{"type":20,"tag":194,"props":20829,"children":20830},{"style":258},[20831],{"type":30,"value":20340},{"type":20,"tag":194,"props":20833,"children":20834},{"style":264},[20835],{"type":30,"value":20836},"(res.state, res);\n",{"type":20,"tag":194,"props":20838,"children":20839},{"class":196,"line":2128},[20840,20845,20849],{"type":20,"tag":194,"props":20841,"children":20842},{"style":264},[20843],{"type":30,"value":20844},"        processed",{"type":20,"tag":194,"props":20846,"children":20847},{"style":252},[20848],{"type":30,"value":18869},{"type":20,"tag":194,"props":20850,"children":20851},{"style":264},[20852],{"type":30,"value":1384},{"type":20,"tag":194,"props":20854,"children":20855},{"class":196,"line":2147},[20856,20860,20865,20869,20874,20878],{"type":20,"tag":194,"props":20857,"children":20858},{"style":252},[20859],{"type":30,"value":1782},{"type":20,"tag":194,"props":20861,"children":20862},{"style":264},[20863],{"type":30,"value":20864}," (processed ",{"type":20,"tag":194,"props":20866,"children":20867},{"style":252},[20868],{"type":30,"value":20096},{"type":20,"tag":194,"props":20870,"children":20871},{"style":264},[20872],{"type":30,"value":20873},"gt;",{"type":20,"tag":194,"props":20875,"children":20876},{"style":252},[20877],{"type":30,"value":461},{"type":20,"tag":194,"props":20879,"children":20880},{"style":264},[20881],{"type":30,"value":20882}," len){\n",{"type":20,"tag":194,"props":20884,"children":20885},{"class":196,"line":2175},[20886,20891,20895,20900,20904,20909,20914,20919,20923,20928],{"type":20,"tag":194,"props":20887,"children":20888},{"style":264},[20889],{"type":30,"value":20890},"            that.input.",{"type":20,"tag":194,"props":20892,"children":20893},{"style":258},[20894],{"type":30,"value":20340},{"type":20,"tag":194,"props":20896,"children":20897},{"style":264},[20898],{"type":30,"value":20899},"((upload) ",{"type":20,"tag":194,"props":20901,"children":20902},{"style":252},[20903],{"type":30,"value":1544},{"type":20,"tag":194,"props":20905,"children":20906},{"style":264},[20907],{"type":30,"value":20908}," Hup.state.",{"type":20,"tag":194,"props":20910,"children":20911},{"style":680},[20912],{"type":30,"value":20913},"FILE_UPLOAD_ALL",{"type":20,"tag":194,"props":20915,"children":20916},{"style":252},[20917],{"type":30,"value":20918}," :",{"type":20,"tag":194,"props":20920,"children":20921},{"style":264},[20922],{"type":30,"value":20908},{"type":20,"tag":194,"props":20924,"children":20925},{"style":680},[20926],{"type":30,"value":20927},"FILE_READ_ALL",{"type":20,"tag":194,"props":20929,"children":20930},{"style":264},[20931],{"type":30,"value":20932}," ,\n",{"type":20,"tag":194,"props":20934,"children":20935},{"class":196,"line":2203},[20936,20941,20945,20949,20953,20957,20961,20965],{"type":20,"tag":194,"props":20937,"children":20938},{"style":264},[20939],{"type":30,"value":20940},"                {state:(upload) ",{"type":20,"tag":194,"props":20942,"children":20943},{"style":252},[20944],{"type":30,"value":1544},{"type":20,"tag":194,"props":20946,"children":20947},{"style":264},[20948],{"type":30,"value":20908},{"type":20,"tag":194,"props":20950,"children":20951},{"style":680},[20952],{"type":30,"value":20913},{"type":20,"tag":194,"props":20954,"children":20955},{"style":252},[20956],{"type":30,"value":20918},{"type":20,"tag":194,"props":20958,"children":20959},{"style":264},[20960],{"type":30,"value":20908},{"type":20,"tag":194,"props":20962,"children":20963},{"style":680},[20964],{"type":30,"value":20927},{"type":20,"tag":194,"props":20966,"children":20967},{"style":264},[20968],{"type":30,"value":20969},", files:len});\n",{"type":20,"tag":194,"props":20971,"children":20972},{"class":196,"line":2211},[20973],{"type":20,"tag":194,"props":20974,"children":20975},{"style":264},[20976],{"type":30,"value":824},{"type":20,"tag":194,"props":20978,"children":20979},{"class":196,"line":2219},[20980,20984,20988,20992,20996,21000,21004],{"type":20,"tag":194,"props":20981,"children":20982},{"style":264},[20983],{"type":30,"value":20796},{"type":20,"tag":194,"props":20985,"children":20986},{"style":258},[20987],{"type":30,"value":4546},{"type":20,"tag":194,"props":20989,"children":20990},{"style":264},[20991],{"type":30,"value":403},{"type":20,"tag":194,"props":20993,"children":20994},{"style":252},[20995],{"type":30,"value":393},{"type":20,"tag":194,"props":20997,"children":20998},{"style":264},[20999],{"type":30,"value":403},{"type":20,"tag":194,"props":21001,"children":21002},{"style":406},[21003],{"type":30,"value":6424},{"type":20,"tag":194,"props":21005,"children":21006},{"style":264},[21007],{"type":30,"value":5702},{"type":20,"tag":194,"props":21009,"children":21010},{"class":196,"line":2227},[21011],{"type":20,"tag":194,"props":21012,"children":21013},{"style":264},[21014],{"type":30,"value":18735},{"type":20,"tag":194,"props":21016,"children":21017},{"class":196,"line":2236},[21018,21022,21026],{"type":20,"tag":194,"props":21019,"children":21020},{"style":264},[21021],{"type":30,"value":20779},{"type":20,"tag":194,"props":21023,"children":21024},{"style":258},[21025],{"type":30,"value":20340},{"type":20,"tag":194,"props":21027,"children":21028},{"style":264},[21029],{"type":30,"value":20836},{"type":20,"tag":194,"props":21031,"children":21032},{"class":196,"line":2245},[21033],{"type":20,"tag":194,"props":21034,"children":21035},{"style":264},[21036],{"type":30,"value":833},{"type":20,"tag":194,"props":21038,"children":21039},{"class":196,"line":2254},[21040],{"type":20,"tag":194,"props":21041,"children":21042},{"style":264},[21043],{"type":30,"value":864},{"type":20,"tag":194,"props":21045,"children":21046},{"class":196,"line":2262},[21047],{"type":20,"tag":194,"props":21048,"children":21049},{"emptyLinePlaceholder":546},[21050],{"type":30,"value":549},{"type":20,"tag":194,"props":21052,"children":21053},{"class":196,"line":2286},[21054],{"type":20,"tag":194,"props":21055,"children":21056},{"style":264},[21057],{"type":30,"value":19773},{"type":20,"tag":5510,"props":21059,"children":21061},{"id":21060},"filtering-by-size",[21062],{"type":30,"value":21063},"Filtering By Size",{"type":20,"tag":21,"props":21065,"children":21066},{},[21067],{"type":30,"value":21068},"This is absurdly simple by comparison - the code above makes it clear we simply test the file size against the max size that the plugin user has set, and if we're above that, fire an event of type FILE_SIZE_ERROR with a meaningful error message.",{"type":20,"tag":21,"props":21070,"children":21071},{},[21072],{"type":30,"value":21073},"The test against maxSize before testing the fileSize is to allow the default value (0) to mean no maximum file size has been set - relying on js to understand 0 as a 'falsey' value. If max size is 0, then we skip the file size test entirely. Similarly, if no mime-types are in the accept array, we skip filtering the files by their type.",{"type":20,"tag":5510,"props":21075,"children":21077},{"id":21076},"better-docs",[21078],{"type":30,"value":21079},"Better Docs",{"type":20,"tag":21,"props":21081,"children":21082},{},[21083,21085,21092,21094,21100],{"type":30,"value":21084},"The documentation for HUp was a bit rushed. I followed the lead of my (still very alpha) ",{"type":20,"tag":25,"props":21086,"children":21089},{"href":21087,"rel":21088},"https://github.com/SaneMethod/KisKit",[50],[21090],{"type":30,"value":21091},"PHP Framework KisKit",{"type":30,"value":21093}," End Shameless Plug and tidied it up a bit. ",{"type":20,"tag":25,"props":21095,"children":21097},{"href":14819,"rel":21096},[50],[21098],{"type":30,"value":21099},"Take a look for yourself",{"type":30,"value":21101},", and feel free to open up an issue if you find bugs / want enhancements - your request might well make for a good future post. ;)",{"type":20,"tag":3951,"props":21103,"children":21104},{},[21105],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":21107},[21108,21109,21110],{"id":18461,"depth":207,"text":18464},{"id":21060,"depth":207,"text":21063},{"id":21076,"depth":207,"text":21079},"content:ckeefer:2013-5:ajax-uploader.md","ckeefer/2013-5/ajax-uploader.md","ckeefer/2013-5/ajax-uploader",{"user":3970,"name":3971},{"_path":21116,"_dir":21117,"_draft":7,"_partial":7,"_locale":8,"title":21118,"description":21119,"publishDate":21120,"tags":21121,"excerpt":21119,"body":21122,"_type":3963,"_id":23954,"_source":3965,"_file":23955,"_stem":23956,"_extension":3968,"author":23957},"/ckeefer/2013-11/jquery-ajax-blobs","2013-11","jQuery Ajax Blobs and Array Buffers","A big part of what makes jQuery a regular part of so many web projects is the clean interface it offers us for a number of sometimes messy built-in aspects of javascript. The most obvious is the DOM interface; and in second place, jquery ajax and its various shorthand methods. Abstracting away the difference between ActiveXObject and XMLHttpRequest is one of the most obvious benefits - but even if you don't need to worry about supporting old versions of IE, you might well enjoy the clean, object-based, promise-returning interface that jquery ajax offers.","2013-11-21",[13,14],{"type":17,"children":21123,"toc":23952},[21124,21128,21149,21154,21159,21359,21387,21498,21521,21526,21590,21602,21607,21768,21773,21796,21801,21806,22256,22275,22289,22294,22299,22735,22763,22768,22773,22778,23937,23948],{"type":20,"tag":21,"props":21125,"children":21126},{},[21127],{"type":30,"value":21119},{"type":20,"tag":21,"props":21129,"children":21130},{},[21131,21133,21139,21140,21147],{"type":30,"value":21132},"It's a shame then, that if you want to take advantage of XMLHttpRequest Level 2 features like ",{"type":20,"tag":25,"props":21134,"children":21137},{"href":21135,"rel":21136},"https://developer.mozilla.org/en-US/docs/Web/API/Blob",[50],[21138],{"type":30,"value":15029},{"type":30,"value":174},{"type":20,"tag":25,"props":21141,"children":21144},{"href":21142,"rel":21143},"https://developer.mozilla.org/en-US/docs/Web/API/ArrayBuffer",[50],[21145],{"type":30,"value":21146},"ArrayBuffer",{"type":30,"value":21148}," uploading/downloading, you have to fall back to the standard javascript api.",{"type":20,"tag":21,"props":21150,"children":21151},{},[21152],{"type":30,"value":21153},"Let's fix that, shall we?",{"type":20,"tag":21,"props":21155,"children":21156},{},[21157],{"type":30,"value":21158},"First, let's have an example of what recieving a Blob might look like with the standard api:",{"type":20,"tag":184,"props":21160,"children":21162},{"className":186,"code":21161,"language":188,"meta":8,"style":8},"var xhr = new XMLHttpRequest();\n\nxhr.addEventListener('load', function(){\n    if (xhr.status == 200){\n        //Do something with xhr.response (not responseText), which should be a Blob\n    }\n});\n\nxhr.open('GET', 'http://target.url');\nxhr.responseType = 'blob';\nxhr.send(null);\n",[21163],{"type":20,"tag":68,"props":21164,"children":21165},{"__ignoreMap":8},[21166,21193,21200,21231,21255,21263,21270,21277,21284,21316,21336],{"type":20,"tag":194,"props":21167,"children":21168},{"class":196,"line":197},[21169,21173,21177,21181,21185,21189],{"type":20,"tag":194,"props":21170,"children":21171},{"style":252},[21172],{"type":30,"value":4057},{"type":20,"tag":194,"props":21174,"children":21175},{"style":264},[21176],{"type":30,"value":4062},{"type":20,"tag":194,"props":21178,"children":21179},{"style":252},[21180],{"type":30,"value":461},{"type":20,"tag":194,"props":21182,"children":21183},{"style":252},[21184],{"type":30,"value":1031},{"type":20,"tag":194,"props":21186,"children":21187},{"style":258},[21188],{"type":30,"value":4075},{"type":20,"tag":194,"props":21190,"children":21191},{"style":264},[21192],{"type":30,"value":539},{"type":20,"tag":194,"props":21194,"children":21195},{"class":196,"line":207},[21196],{"type":20,"tag":194,"props":21197,"children":21198},{"emptyLinePlaceholder":546},[21199],{"type":30,"value":549},{"type":20,"tag":194,"props":21201,"children":21202},{"class":196,"line":216},[21203,21207,21211,21215,21219,21223,21227],{"type":20,"tag":194,"props":21204,"children":21205},{"style":264},[21206],{"type":30,"value":4094},{"type":20,"tag":194,"props":21208,"children":21209},{"style":258},[21210],{"type":30,"value":4099},{"type":20,"tag":194,"props":21212,"children":21213},{"style":264},[21214],{"type":30,"value":403},{"type":20,"tag":194,"props":21216,"children":21217},{"style":506},[21218],{"type":30,"value":4108},{"type":20,"tag":194,"props":21220,"children":21221},{"style":264},[21222],{"type":30,"value":414},{"type":20,"tag":194,"props":21224,"children":21225},{"style":252},[21226],{"type":30,"value":393},{"type":20,"tag":194,"props":21228,"children":21229},{"style":264},[21230],{"type":30,"value":4121},{"type":20,"tag":194,"props":21232,"children":21233},{"class":196,"line":225},[21234,21238,21243,21247,21251],{"type":20,"tag":194,"props":21235,"children":21236},{"style":252},[21237],{"type":30,"value":1360},{"type":20,"tag":194,"props":21239,"children":21240},{"style":264},[21241],{"type":30,"value":21242}," (xhr.status ",{"type":20,"tag":194,"props":21244,"children":21245},{"style":252},[21246],{"type":30,"value":7544},{"type":20,"tag":194,"props":21248,"children":21249},{"style":680},[21250],{"type":30,"value":5176},{"type":20,"tag":194,"props":21252,"children":21253},{"style":264},[21254],{"type":30,"value":4253},{"type":20,"tag":194,"props":21256,"children":21257},{"class":196,"line":234},[21258],{"type":20,"tag":194,"props":21259,"children":21260},{"style":201},[21261],{"type":30,"value":21262},"        //Do something with xhr.response (not responseText), which should be a Blob\n",{"type":20,"tag":194,"props":21264,"children":21265},{"class":196,"line":243},[21266],{"type":20,"tag":194,"props":21267,"children":21268},{"style":264},[21269],{"type":30,"value":1657},{"type":20,"tag":194,"props":21271,"children":21272},{"class":196,"line":275},[21273],{"type":20,"tag":194,"props":21274,"children":21275},{"style":264},[21276],{"type":30,"value":4204},{"type":20,"tag":194,"props":21278,"children":21279},{"class":196,"line":284},[21280],{"type":20,"tag":194,"props":21281,"children":21282},{"emptyLinePlaceholder":546},[21283],{"type":30,"value":549},{"type":20,"tag":194,"props":21285,"children":21286},{"class":196,"line":311},[21287,21291,21295,21299,21303,21307,21312],{"type":20,"tag":194,"props":21288,"children":21289},{"style":264},[21290],{"type":30,"value":4094},{"type":20,"tag":194,"props":21292,"children":21293},{"style":258},[21294],{"type":30,"value":4325},{"type":20,"tag":194,"props":21296,"children":21297},{"style":264},[21298],{"type":30,"value":403},{"type":20,"tag":194,"props":21300,"children":21301},{"style":506},[21302],{"type":30,"value":4450},{"type":20,"tag":194,"props":21304,"children":21305},{"style":264},[21306],{"type":30,"value":414},{"type":20,"tag":194,"props":21308,"children":21309},{"style":506},[21310],{"type":30,"value":21311},"'http://target.url'",{"type":20,"tag":194,"props":21313,"children":21314},{"style":264},[21315],{"type":30,"value":1649},{"type":20,"tag":194,"props":21317,"children":21318},{"class":196,"line":320},[21319,21323,21327,21332],{"type":20,"tag":194,"props":21320,"children":21321},{"style":264},[21322],{"type":30,"value":4300},{"type":20,"tag":194,"props":21324,"children":21325},{"style":252},[21326],{"type":30,"value":461},{"type":20,"tag":194,"props":21328,"children":21329},{"style":506},[21330],{"type":30,"value":21331}," 'blob'",{"type":20,"tag":194,"props":21333,"children":21334},{"style":264},[21335],{"type":30,"value":1384},{"type":20,"tag":194,"props":21337,"children":21338},{"class":196,"line":347},[21339,21343,21347,21351,21355],{"type":20,"tag":194,"props":21340,"children":21341},{"style":264},[21342],{"type":30,"value":4094},{"type":20,"tag":194,"props":21344,"children":21345},{"style":258},[21346],{"type":30,"value":4368},{"type":20,"tag":194,"props":21348,"children":21349},{"style":264},[21350],{"type":30,"value":403},{"type":20,"tag":194,"props":21352,"children":21353},{"style":680},[21354],{"type":30,"value":3827},{"type":20,"tag":194,"props":21356,"children":21357},{"style":264},[21358],{"type":30,"value":1649},{"type":20,"tag":21,"props":21360,"children":21361},{},[21362,21364,21370,21371,21377,21379,21385],{"type":30,"value":21363},"It's not terrible, but we're sure to miss being able to dangle our ",{"type":20,"tag":68,"props":21365,"children":21367},{"className":21366},[],[21368],{"type":30,"value":21369},".done",{"type":30,"value":174},{"type":20,"tag":68,"props":21372,"children":21374},{"className":21373},[],[21375],{"type":30,"value":21376},".fail",{"type":30,"value":21378}," blocks off of our nice, compact ",{"type":20,"tag":68,"props":21380,"children":21382},{"className":21381},[],[21383],{"type":30,"value":21384},"$.ajax",{"type":30,"value":21386}," request. What we want is to be able to do something like this:",{"type":20,"tag":184,"props":21388,"children":21390},{"className":186,"code":21389,"language":188,"meta":8,"style":8},"$.ajax({\n    dataType:'blob',\n    type:'GET',\n    url:'http://target.url'\n}).done(function(blob){\n    // Do something with the Blob returned to us from the ajax request\n});\n",[21391],{"type":20,"tag":68,"props":21392,"children":21393},{"__ignoreMap":8},[21394,21409,21425,21440,21452,21483,21491],{"type":20,"tag":194,"props":21395,"children":21396},{"class":196,"line":197},[21397,21401,21405],{"type":20,"tag":194,"props":21398,"children":21399},{"style":264},[21400],{"type":30,"value":4427},{"type":20,"tag":194,"props":21402,"children":21403},{"style":258},[21404],{"type":30,"value":4432},{"type":20,"tag":194,"props":21406,"children":21407},{"style":264},[21408],{"type":30,"value":4437},{"type":20,"tag":194,"props":21410,"children":21411},{"class":196,"line":207},[21412,21416,21421],{"type":20,"tag":194,"props":21413,"children":21414},{"style":264},[21415],{"type":30,"value":4478},{"type":20,"tag":194,"props":21417,"children":21418},{"style":506},[21419],{"type":30,"value":21420},"'blob'",{"type":20,"tag":194,"props":21422,"children":21423},{"style":264},[21424],{"type":30,"value":1075},{"type":20,"tag":194,"props":21426,"children":21427},{"class":196,"line":216},[21428,21432,21436],{"type":20,"tag":194,"props":21429,"children":21430},{"style":264},[21431],{"type":30,"value":4445},{"type":20,"tag":194,"props":21433,"children":21434},{"style":506},[21435],{"type":30,"value":4450},{"type":20,"tag":194,"props":21437,"children":21438},{"style":264},[21439],{"type":30,"value":1075},{"type":20,"tag":194,"props":21441,"children":21442},{"class":196,"line":225},[21443,21447],{"type":20,"tag":194,"props":21444,"children":21445},{"style":264},[21446],{"type":30,"value":4462},{"type":20,"tag":194,"props":21448,"children":21449},{"style":506},[21450],{"type":30,"value":21451},"'http://target.url'\n",{"type":20,"tag":194,"props":21453,"children":21454},{"class":196,"line":234},[21455,21459,21463,21467,21471,21475,21479],{"type":20,"tag":194,"props":21456,"children":21457},{"style":264},[21458],{"type":30,"value":4491},{"type":20,"tag":194,"props":21460,"children":21461},{"style":258},[21462],{"type":30,"value":4496},{"type":20,"tag":194,"props":21464,"children":21465},{"style":264},[21466],{"type":30,"value":403},{"type":20,"tag":194,"props":21468,"children":21469},{"style":252},[21470],{"type":30,"value":393},{"type":20,"tag":194,"props":21472,"children":21473},{"style":264},[21474],{"type":30,"value":403},{"type":20,"tag":194,"props":21476,"children":21477},{"style":406},[21478],{"type":30,"value":4891},{"type":20,"tag":194,"props":21480,"children":21481},{"style":264},[21482],{"type":30,"value":4253},{"type":20,"tag":194,"props":21484,"children":21485},{"class":196,"line":243},[21486],{"type":20,"tag":194,"props":21487,"children":21488},{"style":201},[21489],{"type":30,"value":21490},"    // Do something with the Blob returned to us from the ajax request\n",{"type":20,"tag":194,"props":21492,"children":21493},{"class":196,"line":275},[21494],{"type":20,"tag":194,"props":21495,"children":21496},{"style":264},[21497],{"type":30,"value":4204},{"type":20,"tag":21,"props":21499,"children":21500},{},[21501,21503,21510,21512,21519],{"type":30,"value":21502},"So, we're going to borrow a trick we discussed back in our ",{"type":20,"tag":25,"props":21504,"children":21507},{"href":21505,"rel":21506},"http://www.alproduction.local/blog/2013/06/ajax-caching-transports-compatible-with-jquery-deferred/",[50],[21508],{"type":30,"value":21509},"Ajax Caching",{"type":30,"value":21511}," article, and create an ",{"type":20,"tag":25,"props":21513,"children":21516},{"href":21514,"rel":21515},"http://api.jquery.com/jQuery.ajaxTransport/",[50],[21517],{"type":30,"value":21518},"Ajax Transport",{"type":30,"value":21520}," to handle sending and receiving Blobs and ArrayBuffers.",{"type":20,"tag":21,"props":21522,"children":21523},{},[21524],{"type":30,"value":21525},"Final code is included at the end of the article (for those who want to get straight to the good stuff), but let's walk through it and discuss what's happening.",{"type":20,"tag":184,"props":21527,"children":21529},{"className":186,"code":21528,"language":188,"meta":8,"style":8},"$.ajaxTransport('+*', function(options, originalOptions, jqXHR){\n",[21530],{"type":20,"tag":68,"props":21531,"children":21532},{"__ignoreMap":8},[21533],{"type":20,"tag":194,"props":21534,"children":21535},{"class":196,"line":197},[21536,21540,21544,21548,21553,21557,21561,21565,21569,21573,21578,21582,21586],{"type":20,"tag":194,"props":21537,"children":21538},{"style":264},[21539],{"type":30,"value":4427},{"type":20,"tag":194,"props":21541,"children":21542},{"style":258},[21543],{"type":30,"value":14196},{"type":20,"tag":194,"props":21545,"children":21546},{"style":264},[21547],{"type":30,"value":403},{"type":20,"tag":194,"props":21549,"children":21550},{"style":506},[21551],{"type":30,"value":21552},"'+*'",{"type":20,"tag":194,"props":21554,"children":21555},{"style":264},[21556],{"type":30,"value":414},{"type":20,"tag":194,"props":21558,"children":21559},{"style":252},[21560],{"type":30,"value":393},{"type":20,"tag":194,"props":21562,"children":21563},{"style":264},[21564],{"type":30,"value":403},{"type":20,"tag":194,"props":21566,"children":21567},{"style":406},[21568],{"type":30,"value":12047},{"type":20,"tag":194,"props":21570,"children":21571},{"style":264},[21572],{"type":30,"value":414},{"type":20,"tag":194,"props":21574,"children":21575},{"style":406},[21576],{"type":30,"value":21577},"originalOptions",{"type":20,"tag":194,"props":21579,"children":21580},{"style":264},[21581],{"type":30,"value":414},{"type":20,"tag":194,"props":21583,"children":21584},{"style":406},[21585],{"type":30,"value":4563},{"type":20,"tag":194,"props":21587,"children":21588},{"style":264},[21589],{"type":30,"value":4253},{"type":20,"tag":21,"props":21591,"children":21592},{},[21593,21595,21600],{"type":30,"value":21594},"Notice the \"+",{"type":20,"tag":4379,"props":21596,"children":21597},{},[21598],{"type":30,"value":21599},"\" string? If you recall from our Ajax Caching article, this string indicates what dataType we want to match against when considering whether to use the transports defined in the following function. There we set type 'json', since we only wanted to cache json replies. Here though, we set '",{"type":30,"value":21601},"' to match all types (we'll narrow our definition down inside the function proper - we just want to make sure that our function gets a crack at providing the transport whenever appropriate, and the expected return dataType could be anything if we're sending a blob or arraybuffer).",{"type":20,"tag":21,"props":21603,"children":21604},{},[21605],{"type":30,"value":21606},"But what's with the '+' preceeding the '*'? That's a little (undocumented) trick found from perusing the jquery source - it indicates we want our transport to be prepended to the list of available transports, as opposed to appended. When matching against all types, we need to include this to prevent the standard transport factory from hogging the request.",{"type":20,"tag":184,"props":21608,"children":21610},{"className":186,"code":21609,"language":188,"meta":8,"style":8},"if (window.FormData && ((options.dataType && (options.dataType == 'blob' || options.dataType == 'arraybuffer'))\n        || (options.data && ((window.Blob && options.data instanceof Blob)\n            || (window.ArrayBuffer && options.data instanceof ArrayBuffer)))\n        ))\n    {\n",[21611],{"type":20,"tag":68,"props":21612,"children":21613},{"__ignoreMap":8},[21614,21676,21718,21753,21761],{"type":20,"tag":194,"props":21615,"children":21616},{"class":196,"line":197},[21617,21622,21627,21631,21636,21640,21645,21649,21653,21657,21662,21666,21671],{"type":20,"tag":194,"props":21618,"children":21619},{"style":252},[21620],{"type":30,"value":21621},"if",{"type":20,"tag":194,"props":21623,"children":21624},{"style":264},[21625],{"type":30,"value":21626}," (window.FormData ",{"type":20,"tag":194,"props":21628,"children":21629},{"style":252},[21630],{"type":30,"value":1920},{"type":20,"tag":194,"props":21632,"children":21633},{"style":264},[21634],{"type":30,"value":21635}," ((options.dataType ",{"type":20,"tag":194,"props":21637,"children":21638},{"style":252},[21639],{"type":30,"value":1920},{"type":20,"tag":194,"props":21641,"children":21642},{"style":264},[21643],{"type":30,"value":21644}," (options.dataType ",{"type":20,"tag":194,"props":21646,"children":21647},{"style":252},[21648],{"type":30,"value":7544},{"type":20,"tag":194,"props":21650,"children":21651},{"style":506},[21652],{"type":30,"value":21331},{"type":20,"tag":194,"props":21654,"children":21655},{"style":252},[21656],{"type":30,"value":5181},{"type":20,"tag":194,"props":21658,"children":21659},{"style":264},[21660],{"type":30,"value":21661}," options.dataType ",{"type":20,"tag":194,"props":21663,"children":21664},{"style":252},[21665],{"type":30,"value":7544},{"type":20,"tag":194,"props":21667,"children":21668},{"style":506},[21669],{"type":30,"value":21670}," 'arraybuffer'",{"type":20,"tag":194,"props":21672,"children":21673},{"style":264},[21674],{"type":30,"value":21675},"))\n",{"type":20,"tag":194,"props":21677,"children":21678},{"class":196,"line":207},[21679,21684,21688,21692,21697,21701,21706,21710,21714],{"type":20,"tag":194,"props":21680,"children":21681},{"style":252},[21682],{"type":30,"value":21683},"        ||",{"type":20,"tag":194,"props":21685,"children":21686},{"style":264},[21687],{"type":30,"value":12285},{"type":20,"tag":194,"props":21689,"children":21690},{"style":252},[21691],{"type":30,"value":1920},{"type":20,"tag":194,"props":21693,"children":21694},{"style":264},[21695],{"type":30,"value":21696}," ((window.Blob ",{"type":20,"tag":194,"props":21698,"children":21699},{"style":252},[21700],{"type":30,"value":1920},{"type":20,"tag":194,"props":21702,"children":21703},{"style":264},[21704],{"type":30,"value":21705}," options.data ",{"type":20,"tag":194,"props":21707,"children":21708},{"style":252},[21709],{"type":30,"value":17460},{"type":20,"tag":194,"props":21711,"children":21712},{"style":258},[21713],{"type":30,"value":15068},{"type":20,"tag":194,"props":21715,"children":21716},{"style":264},[21717],{"type":30,"value":5702},{"type":20,"tag":194,"props":21719,"children":21720},{"class":196,"line":216},[21721,21726,21731,21735,21739,21743,21748],{"type":20,"tag":194,"props":21722,"children":21723},{"style":252},[21724],{"type":30,"value":21725},"            ||",{"type":20,"tag":194,"props":21727,"children":21728},{"style":264},[21729],{"type":30,"value":21730}," (window.ArrayBuffer ",{"type":20,"tag":194,"props":21732,"children":21733},{"style":252},[21734],{"type":30,"value":1920},{"type":20,"tag":194,"props":21736,"children":21737},{"style":264},[21738],{"type":30,"value":21705},{"type":20,"tag":194,"props":21740,"children":21741},{"style":252},[21742],{"type":30,"value":17460},{"type":20,"tag":194,"props":21744,"children":21745},{"style":258},[21746],{"type":30,"value":21747}," ArrayBuffer",{"type":20,"tag":194,"props":21749,"children":21750},{"style":264},[21751],{"type":30,"value":21752},")))\n",{"type":20,"tag":194,"props":21754,"children":21755},{"class":196,"line":225},[21756],{"type":20,"tag":194,"props":21757,"children":21758},{"style":264},[21759],{"type":30,"value":21760},"        ))\n",{"type":20,"tag":194,"props":21762,"children":21763},{"class":196,"line":234},[21764],{"type":20,"tag":194,"props":21765,"children":21766},{"style":264},[21767],{"type":30,"value":18735},{"type":20,"tag":21,"props":21769,"children":21770},{},[21771],{"type":30,"value":21772},"I told you we'd narrow down our definition. :)",{"type":20,"tag":21,"props":21774,"children":21775},{},[21776,21778,21785,21787,21794],{"type":30,"value":21777},"So what's this monster if statement checking against? First, we check against ",{"type":20,"tag":25,"props":21779,"children":21782},{"href":21780,"rel":21781},"https://developer.mozilla.org/en-US/docs/Web/API/FormData",[50],[21783],{"type":30,"value":21784},"window.FormData",{"type":30,"value":21786},"; as a feature of ",{"type":20,"tag":25,"props":21788,"children":21791},{"href":21789,"rel":21790},"http://www.w3.org/TR/XMLHttpRequest2/#interface-formdata",[50],[21792],{"type":30,"value":21793},"XMLHttpRequest Level 2",{"type":30,"value":21795},", its a reasonable way to feature detect whether the browser is ready to provide us the necessary features for blob/arraybuffer sending/receiving.",{"type":20,"tag":21,"props":21797,"children":21798},{},[21799],{"type":30,"value":21800},"Next, we check to see whether a dataType has been defined, and if so, whether the dataType is blob or arraybuffer, indicating we're expecting our request to return us one of these data types.",{"type":20,"tag":21,"props":21802,"children":21803},{},[21804],{"type":30,"value":21805},"Otherwise, we check to see whether data has been defined, and if so, whether the browser supports Blobs and our data is an instance of Blob, or the same for array buffers. If the browser supports XMLHttpRequest 2 and we're either sending or receiving a blob/arraybuffer (or sending AND receiving), then we provide the transport. Remember, for $.ajaxTransport, we indicate we're providing the transport by returning something. Returning nothing indicates that the next transport factory should try to handle this request.",{"type":20,"tag":184,"props":21807,"children":21809},{"className":186,"code":21808,"language":188,"meta":8,"style":8},"        return {\n            send: function(headers, completeCallback){\n                var xhr = new XMLHttpRequest(),\n                    url = options.url || window.location.href,\n                    type = options.type || 'GET',\n                    dataType = options.dataType || 'text',\n                    data = options.data || null,\n                    async = options.async || true;\n\n                xhr.addEventListener('load', function(){\n                    var res = {};\n\n                    res[dataType] = xhr.response;\n                    completeCallback(xhr.status, xhr.statusText, res, xhr.getAllResponseHeaders());\n                });\n\n                xhr.open(type, url, async);\n                xhr.responseType = dataType;\n                xhr.send(data);\n            },\n            abort: function(){\n                jqXHR.abort();\n            }\n        };\n",[21810],{"type":20,"tag":68,"props":21811,"children":21812},{"__ignoreMap":8},[21813,21824,21860,21887,21913,21942,21971,22000,22029,22036,22068,22087,22094,22111,22134,22141,22148,22164,22181,22197,22205,22225,22242,22249],{"type":20,"tag":194,"props":21814,"children":21815},{"class":196,"line":197},[21816,21820],{"type":20,"tag":194,"props":21817,"children":21818},{"style":252},[21819],{"type":30,"value":1591},{"type":20,"tag":194,"props":21821,"children":21822},{"style":264},[21823],{"type":30,"value":595},{"type":20,"tag":194,"props":21825,"children":21826},{"class":196,"line":207},[21827,21832,21836,21840,21844,21848,21852,21856],{"type":20,"tag":194,"props":21828,"children":21829},{"style":258},[21830],{"type":30,"value":21831},"            send",{"type":20,"tag":194,"props":21833,"children":21834},{"style":264},[21835],{"type":30,"value":5035},{"type":20,"tag":194,"props":21837,"children":21838},{"style":252},[21839],{"type":30,"value":393},{"type":20,"tag":194,"props":21841,"children":21842},{"style":264},[21843],{"type":30,"value":403},{"type":20,"tag":194,"props":21845,"children":21846},{"style":406},[21847],{"type":30,"value":1501},{"type":20,"tag":194,"props":21849,"children":21850},{"style":264},[21851],{"type":30,"value":414},{"type":20,"tag":194,"props":21853,"children":21854},{"style":406},[21855],{"type":30,"value":14437},{"type":20,"tag":194,"props":21857,"children":21858},{"style":264},[21859],{"type":30,"value":4253},{"type":20,"tag":194,"props":21861,"children":21862},{"class":196,"line":216},[21863,21867,21871,21875,21879,21883],{"type":20,"tag":194,"props":21864,"children":21865},{"style":252},[21866],{"type":30,"value":13912},{"type":20,"tag":194,"props":21868,"children":21869},{"style":264},[21870],{"type":30,"value":4062},{"type":20,"tag":194,"props":21872,"children":21873},{"style":252},[21874],{"type":30,"value":461},{"type":20,"tag":194,"props":21876,"children":21877},{"style":252},[21878],{"type":30,"value":1031},{"type":20,"tag":194,"props":21880,"children":21881},{"style":258},[21882],{"type":30,"value":4075},{"type":20,"tag":194,"props":21884,"children":21885},{"style":264},[21886],{"type":30,"value":476},{"type":20,"tag":194,"props":21888,"children":21889},{"class":196,"line":225},[21890,21895,21899,21904,21908],{"type":20,"tag":194,"props":21891,"children":21892},{"style":264},[21893],{"type":30,"value":21894},"                    url ",{"type":20,"tag":194,"props":21896,"children":21897},{"style":252},[21898],{"type":30,"value":461},{"type":20,"tag":194,"props":21900,"children":21901},{"style":264},[21902],{"type":30,"value":21903}," options.url ",{"type":20,"tag":194,"props":21905,"children":21906},{"style":252},[21907],{"type":30,"value":519},{"type":20,"tag":194,"props":21909,"children":21910},{"style":264},[21911],{"type":30,"value":21912}," window.location.href,\n",{"type":20,"tag":194,"props":21914,"children":21915},{"class":196,"line":234},[21916,21921,21925,21929,21933,21938],{"type":20,"tag":194,"props":21917,"children":21918},{"style":264},[21919],{"type":30,"value":21920},"                    type ",{"type":20,"tag":194,"props":21922,"children":21923},{"style":252},[21924],{"type":30,"value":461},{"type":20,"tag":194,"props":21926,"children":21927},{"style":264},[21928],{"type":30,"value":12276},{"type":20,"tag":194,"props":21930,"children":21931},{"style":252},[21932],{"type":30,"value":519},{"type":20,"tag":194,"props":21934,"children":21935},{"style":506},[21936],{"type":30,"value":21937}," 'GET'",{"type":20,"tag":194,"props":21939,"children":21940},{"style":264},[21941],{"type":30,"value":1075},{"type":20,"tag":194,"props":21943,"children":21944},{"class":196,"line":243},[21945,21950,21954,21958,21962,21967],{"type":20,"tag":194,"props":21946,"children":21947},{"style":264},[21948],{"type":30,"value":21949},"                    dataType ",{"type":20,"tag":194,"props":21951,"children":21952},{"style":252},[21953],{"type":30,"value":461},{"type":20,"tag":194,"props":21955,"children":21956},{"style":264},[21957],{"type":30,"value":21661},{"type":20,"tag":194,"props":21959,"children":21960},{"style":252},[21961],{"type":30,"value":519},{"type":20,"tag":194,"props":21963,"children":21964},{"style":506},[21965],{"type":30,"value":21966}," 'text'",{"type":20,"tag":194,"props":21968,"children":21969},{"style":264},[21970],{"type":30,"value":1075},{"type":20,"tag":194,"props":21972,"children":21973},{"class":196,"line":275},[21974,21979,21983,21987,21991,21996],{"type":20,"tag":194,"props":21975,"children":21976},{"style":264},[21977],{"type":30,"value":21978},"                    data ",{"type":20,"tag":194,"props":21980,"children":21981},{"style":252},[21982],{"type":30,"value":461},{"type":20,"tag":194,"props":21984,"children":21985},{"style":264},[21986],{"type":30,"value":21705},{"type":20,"tag":194,"props":21988,"children":21989},{"style":252},[21990],{"type":30,"value":519},{"type":20,"tag":194,"props":21992,"children":21993},{"style":680},[21994],{"type":30,"value":21995}," null",{"type":20,"tag":194,"props":21997,"children":21998},{"style":264},[21999],{"type":30,"value":1075},{"type":20,"tag":194,"props":22001,"children":22002},{"class":196,"line":284},[22003,22008,22012,22017,22021,22025],{"type":20,"tag":194,"props":22004,"children":22005},{"style":264},[22006],{"type":30,"value":22007},"                    async ",{"type":20,"tag":194,"props":22009,"children":22010},{"style":252},[22011],{"type":30,"value":461},{"type":20,"tag":194,"props":22013,"children":22014},{"style":264},[22015],{"type":30,"value":22016}," options.async ",{"type":20,"tag":194,"props":22018,"children":22019},{"style":252},[22020],{"type":30,"value":519},{"type":20,"tag":194,"props":22022,"children":22023},{"style":680},[22024],{"type":30,"value":1831},{"type":20,"tag":194,"props":22026,"children":22027},{"style":264},[22028],{"type":30,"value":1384},{"type":20,"tag":194,"props":22030,"children":22031},{"class":196,"line":311},[22032],{"type":20,"tag":194,"props":22033,"children":22034},{"emptyLinePlaceholder":546},[22035],{"type":30,"value":549},{"type":20,"tag":194,"props":22037,"children":22038},{"class":196,"line":320},[22039,22044,22048,22052,22056,22060,22064],{"type":20,"tag":194,"props":22040,"children":22041},{"style":264},[22042],{"type":30,"value":22043},"                xhr.",{"type":20,"tag":194,"props":22045,"children":22046},{"style":258},[22047],{"type":30,"value":4099},{"type":20,"tag":194,"props":22049,"children":22050},{"style":264},[22051],{"type":30,"value":403},{"type":20,"tag":194,"props":22053,"children":22054},{"style":506},[22055],{"type":30,"value":4108},{"type":20,"tag":194,"props":22057,"children":22058},{"style":264},[22059],{"type":30,"value":414},{"type":20,"tag":194,"props":22061,"children":22062},{"style":252},[22063],{"type":30,"value":393},{"type":20,"tag":194,"props":22065,"children":22066},{"style":264},[22067],{"type":30,"value":4121},{"type":20,"tag":194,"props":22069,"children":22070},{"class":196,"line":347},[22071,22075,22079,22083],{"type":20,"tag":194,"props":22072,"children":22073},{"style":252},[22074],{"type":30,"value":19597},{"type":20,"tag":194,"props":22076,"children":22077},{"style":264},[22078],{"type":30,"value":7365},{"type":20,"tag":194,"props":22080,"children":22081},{"style":252},[22082],{"type":30,"value":461},{"type":20,"tag":194,"props":22084,"children":22085},{"style":264},[22086],{"type":30,"value":14504},{"type":20,"tag":194,"props":22088,"children":22089},{"class":196,"line":356},[22090],{"type":20,"tag":194,"props":22091,"children":22092},{"emptyLinePlaceholder":546},[22093],{"type":30,"value":549},{"type":20,"tag":194,"props":22095,"children":22096},{"class":196,"line":378},[22097,22102,22106],{"type":20,"tag":194,"props":22098,"children":22099},{"style":264},[22100],{"type":30,"value":22101},"                    res[dataType] ",{"type":20,"tag":194,"props":22103,"children":22104},{"style":252},[22105],{"type":30,"value":461},{"type":20,"tag":194,"props":22107,"children":22108},{"style":264},[22109],{"type":30,"value":22110}," xhr.response;\n",{"type":20,"tag":194,"props":22112,"children":22113},{"class":196,"line":387},[22114,22119,22124,22129],{"type":20,"tag":194,"props":22115,"children":22116},{"style":258},[22117],{"type":30,"value":22118},"                    completeCallback",{"type":20,"tag":194,"props":22120,"children":22121},{"style":264},[22122],{"type":30,"value":22123},"(xhr.status, xhr.statusText, res, xhr.",{"type":20,"tag":194,"props":22125,"children":22126},{"style":258},[22127],{"type":30,"value":22128},"getAllResponseHeaders",{"type":20,"tag":194,"props":22130,"children":22131},{"style":264},[22132],{"type":30,"value":22133},"());\n",{"type":20,"tag":194,"props":22135,"children":22136},{"class":196,"line":445},[22137],{"type":20,"tag":194,"props":22138,"children":22139},{"style":264},[22140],{"type":30,"value":11819},{"type":20,"tag":194,"props":22142,"children":22143},{"class":196,"line":479},[22144],{"type":20,"tag":194,"props":22145,"children":22146},{"emptyLinePlaceholder":546},[22147],{"type":30,"value":549},{"type":20,"tag":194,"props":22149,"children":22150},{"class":196,"line":542},[22151,22155,22159],{"type":20,"tag":194,"props":22152,"children":22153},{"style":264},[22154],{"type":30,"value":22043},{"type":20,"tag":194,"props":22156,"children":22157},{"style":258},[22158],{"type":30,"value":4325},{"type":20,"tag":194,"props":22160,"children":22161},{"style":264},[22162],{"type":30,"value":22163},"(type, url, async);\n",{"type":20,"tag":194,"props":22165,"children":22166},{"class":196,"line":552},[22167,22172,22176],{"type":20,"tag":194,"props":22168,"children":22169},{"style":264},[22170],{"type":30,"value":22171},"                xhr.responseType ",{"type":20,"tag":194,"props":22173,"children":22174},{"style":252},[22175],{"type":30,"value":461},{"type":20,"tag":194,"props":22177,"children":22178},{"style":264},[22179],{"type":30,"value":22180}," dataType;\n",{"type":20,"tag":194,"props":22182,"children":22183},{"class":196,"line":598},[22184,22188,22192],{"type":20,"tag":194,"props":22185,"children":22186},{"style":264},[22187],{"type":30,"value":22043},{"type":20,"tag":194,"props":22189,"children":22190},{"style":258},[22191],{"type":30,"value":4368},{"type":20,"tag":194,"props":22193,"children":22194},{"style":264},[22195],{"type":30,"value":22196},"(data);\n",{"type":20,"tag":194,"props":22198,"children":22199},{"class":196,"line":611},[22200],{"type":20,"tag":194,"props":22201,"children":22202},{"style":264},[22203],{"type":30,"value":22204},"            },\n",{"type":20,"tag":194,"props":22206,"children":22207},{"class":196,"line":630},[22208,22213,22217,22221],{"type":20,"tag":194,"props":22209,"children":22210},{"style":258},[22211],{"type":30,"value":22212},"            abort",{"type":20,"tag":194,"props":22214,"children":22215},{"style":264},[22216],{"type":30,"value":5035},{"type":20,"tag":194,"props":22218,"children":22219},{"style":252},[22220],{"type":30,"value":393},{"type":20,"tag":194,"props":22222,"children":22223},{"style":264},[22224],{"type":30,"value":4121},{"type":20,"tag":194,"props":22226,"children":22227},{"class":196,"line":713},[22228,22233,22238],{"type":20,"tag":194,"props":22229,"children":22230},{"style":264},[22231],{"type":30,"value":22232},"                jqXHR.",{"type":20,"tag":194,"props":22234,"children":22235},{"style":258},[22236],{"type":30,"value":22237},"abort",{"type":20,"tag":194,"props":22239,"children":22240},{"style":264},[22241],{"type":30,"value":539},{"type":20,"tag":194,"props":22243,"children":22244},{"class":196,"line":743},[22245],{"type":20,"tag":194,"props":22246,"children":22247},{"style":264},[22248],{"type":30,"value":1121},{"type":20,"tag":194,"props":22250,"children":22251},{"class":196,"line":762},[22252],{"type":20,"tag":194,"props":22253,"children":22254},{"style":264},[22255],{"type":30,"value":9541},{"type":20,"tag":21,"props":22257,"children":22258},{},[22259,22261,22266,22268,22273],{"type":30,"value":22260},"As you'll recall from our Ajax Caching article, we need to provide two functions for a transport - ",{"type":20,"tag":68,"props":22262,"children":22264},{"className":22263},[],[22265],{"type":30,"value":4368},{"type":30,"value":22267},", and ",{"type":20,"tag":68,"props":22269,"children":22271},{"className":22270},[],[22272],{"type":30,"value":22237},{"type":30,"value":22274},". The body of send should look familiar here - we consider the options set in the ajax options block, and set reasonable defaults if the needed options aren't set, instantiate a new XMLHttpRequest object, open the request, set the appropriate response type, and send data as appropriate. In abort, we simply call abort on the jqXHR object passed to the transport factory function.",{"type":20,"tag":21,"props":22276,"children":22277},{},[22278,22280,22287],{"type":30,"value":22279},"So where is this useful? You remember our ",{"type":20,"tag":25,"props":22281,"children":22284},{"href":22282,"rel":22283},"http://www.alproduction.local/blog/2013/04/ajax-upload-part-ii-xhr2-and-filereader/",[50],[22285],{"type":30,"value":22286},"FileReader/XHR2",{"type":30,"value":22288}," plugin, right? This is a complement (and partial replacement, if desired) to that - now we can receive blobs/arraybuffers from the server, as well as send them up, all within the comfortably familiar jQuery interface. Neat, huh?",{"type":20,"tag":21,"props":22290,"children":22291},{},[22292],{"type":30,"value":22293},"But wait! The plugin gives us feedback on upload progress! Can we do that with this ajax transport?",{"type":20,"tag":21,"props":22295,"children":22296},{},[22297],{"type":30,"value":22298},"Of course! Take a look at our xhr2 plugin post again, and you'll see where we're listening in on the 'progress' event on our XMLHttpRequest object. The relevant handler function looks like:",{"type":20,"tag":184,"props":22300,"children":22302},{"className":186,"code":22301,"language":188,"meta":8,"style":8},"DeferXhr.prototype.uploadProgress = function(event){\n        if (event.lengthComputable)\n        {\n            this.progress = (event.loaded/event.total);\n            if (this.options.chunked)\n            {\n                this.progress *= (this.end/this.file.size);\n            }\n            this.time.end = +new Date();\n            this.time.speed = (this.file.size*this.progress)/(this.time.end-this.time.start)*1000;\n            console.log('time:', this.time.end-this.time.start, 'speed:', this.time.speed);\n            this.defer.notify({state:Hup.state.FILE_UPLOAD_PROGRESS, file_name:this.file.name, speed:this.time.speed,\n                progress:this.progress});\n        }\n    };\n",[22303],{"type":20,"tag":68,"props":22304,"children":22305},{"__ignoreMap":8},[22306,22351,22363,22370,22400,22420,22427,22470,22477,22505,22591,22654,22704,22721,22728],{"type":20,"tag":194,"props":22307,"children":22308},{"class":196,"line":197},[22309,22314,22318,22322,22326,22331,22335,22339,22343,22347],{"type":20,"tag":194,"props":22310,"children":22311},{"style":680},[22312],{"type":30,"value":22313},"DeferXhr",{"type":20,"tag":194,"props":22315,"children":22316},{"style":264},[22317],{"type":30,"value":55},{"type":20,"tag":194,"props":22319,"children":22320},{"style":680},[22321],{"type":30,"value":19151},{"type":20,"tag":194,"props":22323,"children":22324},{"style":264},[22325],{"type":30,"value":55},{"type":20,"tag":194,"props":22327,"children":22328},{"style":258},[22329],{"type":30,"value":22330},"uploadProgress",{"type":20,"tag":194,"props":22332,"children":22333},{"style":252},[22334],{"type":30,"value":3298},{"type":20,"tag":194,"props":22336,"children":22337},{"style":252},[22338],{"type":30,"value":3303},{"type":20,"tag":194,"props":22340,"children":22341},{"style":264},[22342],{"type":30,"value":403},{"type":20,"tag":194,"props":22344,"children":22345},{"style":406},[22346],{"type":30,"value":9497},{"type":20,"tag":194,"props":22348,"children":22349},{"style":264},[22350],{"type":30,"value":4253},{"type":20,"tag":194,"props":22352,"children":22353},{"class":196,"line":207},[22354,22358],{"type":20,"tag":194,"props":22355,"children":22356},{"style":252},[22357],{"type":30,"value":1782},{"type":20,"tag":194,"props":22359,"children":22360},{"style":264},[22361],{"type":30,"value":22362}," (event.lengthComputable)\n",{"type":20,"tag":194,"props":22364,"children":22365},{"class":196,"line":216},[22366],{"type":20,"tag":194,"props":22367,"children":22368},{"style":264},[22369],{"type":30,"value":1057},{"type":20,"tag":194,"props":22371,"children":22372},{"class":196,"line":225},[22373,22377,22382,22386,22391,22395],{"type":20,"tag":194,"props":22374,"children":22375},{"style":680},[22376],{"type":30,"value":20330},{"type":20,"tag":194,"props":22378,"children":22379},{"style":264},[22380],{"type":30,"value":22381},".progress ",{"type":20,"tag":194,"props":22383,"children":22384},{"style":252},[22385],{"type":30,"value":461},{"type":20,"tag":194,"props":22387,"children":22388},{"style":264},[22389],{"type":30,"value":22390}," (event.loaded",{"type":20,"tag":194,"props":22392,"children":22393},{"style":252},[22394],{"type":30,"value":12085},{"type":20,"tag":194,"props":22396,"children":22397},{"style":264},[22398],{"type":30,"value":22399},"event.total);\n",{"type":20,"tag":194,"props":22401,"children":22402},{"class":196,"line":234},[22403,22407,22411,22415],{"type":20,"tag":194,"props":22404,"children":22405},{"style":252},[22406],{"type":30,"value":13826},{"type":20,"tag":194,"props":22408,"children":22409},{"style":264},[22410],{"type":30,"value":1172},{"type":20,"tag":194,"props":22412,"children":22413},{"style":680},[22414],{"type":30,"value":4174},{"type":20,"tag":194,"props":22416,"children":22417},{"style":264},[22418],{"type":30,"value":22419},".options.chunked)\n",{"type":20,"tag":194,"props":22421,"children":22422},{"class":196,"line":243},[22423],{"type":20,"tag":194,"props":22424,"children":22425},{"style":264},[22426],{"type":30,"value":2983},{"type":20,"tag":194,"props":22428,"children":22429},{"class":196,"line":275},[22430,22435,22439,22444,22448,22452,22457,22461,22465],{"type":20,"tag":194,"props":22431,"children":22432},{"style":680},[22433],{"type":30,"value":22434},"                this",{"type":20,"tag":194,"props":22436,"children":22437},{"style":264},[22438],{"type":30,"value":22381},{"type":20,"tag":194,"props":22440,"children":22441},{"style":252},[22442],{"type":30,"value":22443},"*=",{"type":20,"tag":194,"props":22445,"children":22446},{"style":264},[22447],{"type":30,"value":1172},{"type":20,"tag":194,"props":22449,"children":22450},{"style":680},[22451],{"type":30,"value":4174},{"type":20,"tag":194,"props":22453,"children":22454},{"style":264},[22455],{"type":30,"value":22456},".end",{"type":20,"tag":194,"props":22458,"children":22459},{"style":252},[22460],{"type":30,"value":12085},{"type":20,"tag":194,"props":22462,"children":22463},{"style":680},[22464],{"type":30,"value":4174},{"type":20,"tag":194,"props":22466,"children":22467},{"style":264},[22468],{"type":30,"value":22469},".file.size);\n",{"type":20,"tag":194,"props":22471,"children":22472},{"class":196,"line":284},[22473],{"type":20,"tag":194,"props":22474,"children":22475},{"style":264},[22476],{"type":30,"value":1121},{"type":20,"tag":194,"props":22478,"children":22479},{"class":196,"line":311},[22480,22484,22489,22493,22497,22501],{"type":20,"tag":194,"props":22481,"children":22482},{"style":680},[22483],{"type":30,"value":20330},{"type":20,"tag":194,"props":22485,"children":22486},{"style":264},[22487],{"type":30,"value":22488},".time.end ",{"type":20,"tag":194,"props":22490,"children":22491},{"style":252},[22492],{"type":30,"value":461},{"type":20,"tag":194,"props":22494,"children":22495},{"style":252},[22496],{"type":30,"value":3679},{"type":20,"tag":194,"props":22498,"children":22499},{"style":258},[22500],{"type":30,"value":668},{"type":20,"tag":194,"props":22502,"children":22503},{"style":264},[22504],{"type":30,"value":539},{"type":20,"tag":194,"props":22506,"children":22507},{"class":196,"line":320},[22508,22512,22517,22521,22525,22529,22534,22538,22542,22547,22551,22555,22559,22564,22569,22573,22578,22582,22587],{"type":20,"tag":194,"props":22509,"children":22510},{"style":680},[22511],{"type":30,"value":20330},{"type":20,"tag":194,"props":22513,"children":22514},{"style":264},[22515],{"type":30,"value":22516},".time.speed ",{"type":20,"tag":194,"props":22518,"children":22519},{"style":252},[22520],{"type":30,"value":461},{"type":20,"tag":194,"props":22522,"children":22523},{"style":264},[22524],{"type":30,"value":1172},{"type":20,"tag":194,"props":22526,"children":22527},{"style":680},[22528],{"type":30,"value":4174},{"type":20,"tag":194,"props":22530,"children":22531},{"style":264},[22532],{"type":30,"value":22533},".file.size",{"type":20,"tag":194,"props":22535,"children":22536},{"style":252},[22537],{"type":30,"value":12099},{"type":20,"tag":194,"props":22539,"children":22540},{"style":680},[22541],{"type":30,"value":4174},{"type":20,"tag":194,"props":22543,"children":22544},{"style":264},[22545],{"type":30,"value":22546},".progress)",{"type":20,"tag":194,"props":22548,"children":22549},{"style":252},[22550],{"type":30,"value":12085},{"type":20,"tag":194,"props":22552,"children":22553},{"style":264},[22554],{"type":30,"value":403},{"type":20,"tag":194,"props":22556,"children":22557},{"style":680},[22558],{"type":30,"value":4174},{"type":20,"tag":194,"props":22560,"children":22561},{"style":264},[22562],{"type":30,"value":22563},".time.end",{"type":20,"tag":194,"props":22565,"children":22566},{"style":252},[22567],{"type":30,"value":22568},"-",{"type":20,"tag":194,"props":22570,"children":22571},{"style":680},[22572],{"type":30,"value":4174},{"type":20,"tag":194,"props":22574,"children":22575},{"style":264},[22576],{"type":30,"value":22577},".time.start)",{"type":20,"tag":194,"props":22579,"children":22580},{"style":252},[22581],{"type":30,"value":12099},{"type":20,"tag":194,"props":22583,"children":22584},{"style":680},[22585],{"type":30,"value":22586},"1000",{"type":20,"tag":194,"props":22588,"children":22589},{"style":264},[22590],{"type":30,"value":1384},{"type":20,"tag":194,"props":22592,"children":22593},{"class":196,"line":347},[22594,22598,22602,22606,22611,22615,22619,22623,22627,22631,22636,22641,22645,22649],{"type":20,"tag":194,"props":22595,"children":22596},{"style":264},[22597],{"type":30,"value":791},{"type":20,"tag":194,"props":22599,"children":22600},{"style":258},[22601],{"type":30,"value":796},{"type":20,"tag":194,"props":22603,"children":22604},{"style":264},[22605],{"type":30,"value":403},{"type":20,"tag":194,"props":22607,"children":22608},{"style":506},[22609],{"type":30,"value":22610},"'time:'",{"type":20,"tag":194,"props":22612,"children":22613},{"style":264},[22614],{"type":30,"value":414},{"type":20,"tag":194,"props":22616,"children":22617},{"style":680},[22618],{"type":30,"value":4174},{"type":20,"tag":194,"props":22620,"children":22621},{"style":264},[22622],{"type":30,"value":22563},{"type":20,"tag":194,"props":22624,"children":22625},{"style":252},[22626],{"type":30,"value":22568},{"type":20,"tag":194,"props":22628,"children":22629},{"style":680},[22630],{"type":30,"value":4174},{"type":20,"tag":194,"props":22632,"children":22633},{"style":264},[22634],{"type":30,"value":22635},".time.start, ",{"type":20,"tag":194,"props":22637,"children":22638},{"style":506},[22639],{"type":30,"value":22640},"'speed:'",{"type":20,"tag":194,"props":22642,"children":22643},{"style":264},[22644],{"type":30,"value":414},{"type":20,"tag":194,"props":22646,"children":22647},{"style":680},[22648],{"type":30,"value":4174},{"type":20,"tag":194,"props":22650,"children":22651},{"style":264},[22652],{"type":30,"value":22653},".time.speed);\n",{"type":20,"tag":194,"props":22655,"children":22656},{"class":196,"line":356},[22657,22661,22666,22671,22676,22681,22686,22690,22695,22699],{"type":20,"tag":194,"props":22658,"children":22659},{"style":680},[22660],{"type":30,"value":20330},{"type":20,"tag":194,"props":22662,"children":22663},{"style":264},[22664],{"type":30,"value":22665},".defer.",{"type":20,"tag":194,"props":22667,"children":22668},{"style":258},[22669],{"type":30,"value":22670},"notify",{"type":20,"tag":194,"props":22672,"children":22673},{"style":264},[22674],{"type":30,"value":22675},"({state:Hup.state.",{"type":20,"tag":194,"props":22677,"children":22678},{"style":680},[22679],{"type":30,"value":22680},"FILE_UPLOAD_PROGRESS",{"type":20,"tag":194,"props":22682,"children":22683},{"style":264},[22684],{"type":30,"value":22685},", file_name:",{"type":20,"tag":194,"props":22687,"children":22688},{"style":680},[22689],{"type":30,"value":4174},{"type":20,"tag":194,"props":22691,"children":22692},{"style":264},[22693],{"type":30,"value":22694},".file.name, speed:",{"type":20,"tag":194,"props":22696,"children":22697},{"style":680},[22698],{"type":30,"value":4174},{"type":20,"tag":194,"props":22700,"children":22701},{"style":264},[22702],{"type":30,"value":22703},".time.speed,\n",{"type":20,"tag":194,"props":22705,"children":22706},{"class":196,"line":378},[22707,22712,22716],{"type":20,"tag":194,"props":22708,"children":22709},{"style":264},[22710],{"type":30,"value":22711},"                progress:",{"type":20,"tag":194,"props":22713,"children":22714},{"style":680},[22715],{"type":30,"value":4174},{"type":20,"tag":194,"props":22717,"children":22718},{"style":264},[22719],{"type":30,"value":22720},".progress});\n",{"type":20,"tag":194,"props":22722,"children":22723},{"class":196,"line":387},[22724],{"type":20,"tag":194,"props":22725,"children":22726},{"style":264},[22727],{"type":30,"value":824},{"type":20,"tag":194,"props":22729,"children":22730},{"class":196,"line":445},[22731],{"type":20,"tag":194,"props":22732,"children":22733},{"style":264},[22734],{"type":30,"value":3940},{"type":20,"tag":21,"props":22736,"children":22737},{},[22738,22740,22746,22748,22755,22757,22762],{"type":30,"value":22739},"By adding a similar handler function with our ajax transport factory on the progress event, we can make calls to ",{"type":20,"tag":68,"props":22741,"children":22743},{"className":22742},[],[22744],{"type":30,"value":22745},"jqXHR.notify",{"type":30,"value":22747}," to send progress events and data to any listening ",{"type":20,"tag":25,"props":22749,"children":22752},{"href":22750,"rel":22751},"http://api.jquery.com/deferred.progress/",[50],[22753],{"type":30,"value":22754},".progress",{"type":30,"value":22756}," handlers dangling from our ",{"type":20,"tag":68,"props":22758,"children":22760},{"className":22759},[],[22761],{"type":30,"value":21384},{"type":30,"value":4407},{"type":20,"tag":21,"props":22764,"children":22765},{},[22766],{"type":30,"value":22767},"This, however, I leave as an exercise for the reader. :)",{"type":20,"tag":21,"props":22769,"children":22770},{},[22771],{"type":30,"value":22772},"If you like, please feel free to push the relevant changes to the gist in question.",{"type":20,"tag":21,"props":22774,"children":22775},{},[22776],{"type":30,"value":22777},"Here's the promised code:",{"type":20,"tag":184,"props":22779,"children":22781},{"className":186,"code":22780,"language":188,"meta":8,"style":8},"(function($){\n    /**\n     * Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2\n     * within the comfortable framework of the jquery ajax request, with full support for promises.\n     *\n     * Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list\n     * of potential transports (so it gets first dibs if the request passes the conditions within to provide the\n     * ajax transport, preventing the standard transport from hogging the request), and the * indicates that\n     * potentially any request with any dataType might want to use the transports provided herein.\n     *\n     * Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -\n     * otherwise jquery will try (and fail) to convert the blob or buffer into a query string.\n     *\n     * This revision now includes sending headers, resolves the stack overflow in abort(), and sets the status text\n     * into the response if the request is unsuccessful.\n     */\n    $.ajaxTransport(\"+*\", function(options, originalOptions, jqXHR){\n        // Test for the conditions that mean we can/want to send/receive blobs or arraybuffers - we need XMLHttpRequest\n        // level 2 (so feature-detect against window.FormData), feature detect against window.Blob or window.ArrayBuffer,\n        // and then check to see if the dataType is blob/arraybuffer or the data itself is a Blob/ArrayBuffer\n        if (window.FormData && ((options.dataType && (options.dataType == 'blob' || options.dataType == 'arraybuffer'))\n            || (options.data && ((window.Blob && options.data instanceof Blob)\n                || (window.ArrayBuffer && options.data instanceof ArrayBuffer)))\n            ))\n        {\n            var xhr;\n\n            return {\n                /**\n                 * Return a transport capable of sending and/or receiving blobs - in this case, we instantiate\n                 * a new XMLHttpRequest and use it to actually perform the request, and funnel the result back\n                 * into the jquery complete callback (such as the success function, done blocks, etc.)\n                 *\n                 * @param headers\n                 * @param completeCallback\n                 */\n                send: function(headers, completeCallback){\n                    var url = options.url || window.location.href,\n                        type = options.type || 'GET',\n                        dataType = options.dataType || 'text',\n                        data = options.data || null,\n                        async = options.async || true;\n\n                    xhr = new XMLHttpRequest();\n                    xhr.addEventListener('load', function(){\n                        var res = {},\n                            success = xhr.status >= 200 && xhr.status \u003C 300 || xhr.status === 304;\n\n                        if (success){\n                            res[dataType] = xhr.response;\n                        } else {\n                            res.text = xhr.statusText;\n                        }\n\n                        completeCallback(xhr.status, xhr.statusText, res, xhr.getAllResponseHeaders());\n                    });\n\n                    xhr.open(type, url, async);\n                    xhr.responseType = dataType;\n\n                    for (var key in headers){\n                        if (headers.hasOwnProperty(key)){\n                            xhr.setRequestHeader(key, headers[key]);\n                        }\n                    }\n\n                    xhr.send(data);\n                },\n                abort: function(){\n                    if (xhr){\n                        xhr.abort();\n                    }\n                }\n            };\n        }\n    });\n})(jQuery);\n",[22782],{"type":20,"tag":68,"props":22783,"children":22784},{"__ignoreMap":8},[22785,22808,22815,22823,22831,22838,22846,22854,22862,22870,22877,22885,22893,22900,22908,22916,22923,22978,22986,22994,23002,23057,23096,23128,23136,23143,23155,23162,23173,23180,23188,23196,23204,23212,23229,23245,23252,23288,23315,23343,23371,23399,23427,23434,23458,23490,23510,23574,23581,23594,23610,23627,23644,23652,23659,23679,23687,23694,23709,23725,23732,23763,23785,23803,23810,23817,23824,23839,23847,23867,23879,23895,23902,23909,23916,23923,23930],{"type":20,"tag":194,"props":22786,"children":22787},{"class":196,"line":197},[22788,22792,22796,22800,22804],{"type":20,"tag":194,"props":22789,"children":22790},{"style":264},[22791],{"type":30,"value":403},{"type":20,"tag":194,"props":22793,"children":22794},{"style":252},[22795],{"type":30,"value":393},{"type":20,"tag":194,"props":22797,"children":22798},{"style":264},[22799],{"type":30,"value":403},{"type":20,"tag":194,"props":22801,"children":22802},{"style":406},[22803],{"type":30,"value":6468},{"type":20,"tag":194,"props":22805,"children":22806},{"style":264},[22807],{"type":30,"value":4253},{"type":20,"tag":194,"props":22809,"children":22810},{"class":196,"line":207},[22811],{"type":20,"tag":194,"props":22812,"children":22813},{"style":201},[22814],{"type":30,"value":1399},{"type":20,"tag":194,"props":22816,"children":22817},{"class":196,"line":216},[22818],{"type":20,"tag":194,"props":22819,"children":22820},{"style":201},[22821],{"type":30,"value":22822},"     * Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2\n",{"type":20,"tag":194,"props":22824,"children":22825},{"class":196,"line":225},[22826],{"type":20,"tag":194,"props":22827,"children":22828},{"style":201},[22829],{"type":30,"value":22830},"     * within the comfortable framework of the jquery ajax request, with full support for promises.\n",{"type":20,"tag":194,"props":22832,"children":22833},{"class":196,"line":234},[22834],{"type":20,"tag":194,"props":22835,"children":22836},{"style":201},[22837],{"type":30,"value":1423},{"type":20,"tag":194,"props":22839,"children":22840},{"class":196,"line":243},[22841],{"type":20,"tag":194,"props":22842,"children":22843},{"style":201},[22844],{"type":30,"value":22845},"     * Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list\n",{"type":20,"tag":194,"props":22847,"children":22848},{"class":196,"line":275},[22849],{"type":20,"tag":194,"props":22850,"children":22851},{"style":201},[22852],{"type":30,"value":22853},"     * of potential transports (so it gets first dibs if the request passes the conditions within to provide the\n",{"type":20,"tag":194,"props":22855,"children":22856},{"class":196,"line":284},[22857],{"type":20,"tag":194,"props":22858,"children":22859},{"style":201},[22860],{"type":30,"value":22861},"     * ajax transport, preventing the standard transport from hogging the request), and the * indicates that\n",{"type":20,"tag":194,"props":22863,"children":22864},{"class":196,"line":311},[22865],{"type":20,"tag":194,"props":22866,"children":22867},{"style":201},[22868],{"type":30,"value":22869},"     * potentially any request with any dataType might want to use the transports provided herein.\n",{"type":20,"tag":194,"props":22871,"children":22872},{"class":196,"line":320},[22873],{"type":20,"tag":194,"props":22874,"children":22875},{"style":201},[22876],{"type":30,"value":1423},{"type":20,"tag":194,"props":22878,"children":22879},{"class":196,"line":347},[22880],{"type":20,"tag":194,"props":22881,"children":22882},{"style":201},[22883],{"type":30,"value":22884},"     * Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -\n",{"type":20,"tag":194,"props":22886,"children":22887},{"class":196,"line":356},[22888],{"type":20,"tag":194,"props":22889,"children":22890},{"style":201},[22891],{"type":30,"value":22892},"     * otherwise jquery will try (and fail) to convert the blob or buffer into a query string.\n",{"type":20,"tag":194,"props":22894,"children":22895},{"class":196,"line":378},[22896],{"type":20,"tag":194,"props":22897,"children":22898},{"style":201},[22899],{"type":30,"value":1423},{"type":20,"tag":194,"props":22901,"children":22902},{"class":196,"line":387},[22903],{"type":20,"tag":194,"props":22904,"children":22905},{"style":201},[22906],{"type":30,"value":22907},"     * This revision now includes sending headers, resolves the stack overflow in abort(), and sets the status text\n",{"type":20,"tag":194,"props":22909,"children":22910},{"class":196,"line":445},[22911],{"type":20,"tag":194,"props":22912,"children":22913},{"style":201},[22914],{"type":30,"value":22915},"     * into the response if the request is unsuccessful.\n",{"type":20,"tag":194,"props":22917,"children":22918},{"class":196,"line":479},[22919],{"type":20,"tag":194,"props":22920,"children":22921},{"style":201},[22922],{"type":30,"value":1448},{"type":20,"tag":194,"props":22924,"children":22925},{"class":196,"line":542},[22926,22930,22934,22938,22942,22946,22950,22954,22958,22962,22966,22970,22974],{"type":20,"tag":194,"props":22927,"children":22928},{"style":264},[22929],{"type":30,"value":13352},{"type":20,"tag":194,"props":22931,"children":22932},{"style":258},[22933],{"type":30,"value":14196},{"type":20,"tag":194,"props":22935,"children":22936},{"style":264},[22937],{"type":30,"value":403},{"type":20,"tag":194,"props":22939,"children":22940},{"style":506},[22941],{"type":30,"value":14205},{"type":20,"tag":194,"props":22943,"children":22944},{"style":264},[22945],{"type":30,"value":414},{"type":20,"tag":194,"props":22947,"children":22948},{"style":252},[22949],{"type":30,"value":393},{"type":20,"tag":194,"props":22951,"children":22952},{"style":264},[22953],{"type":30,"value":403},{"type":20,"tag":194,"props":22955,"children":22956},{"style":406},[22957],{"type":30,"value":12047},{"type":20,"tag":194,"props":22959,"children":22960},{"style":264},[22961],{"type":30,"value":414},{"type":20,"tag":194,"props":22963,"children":22964},{"style":406},[22965],{"type":30,"value":21577},{"type":20,"tag":194,"props":22967,"children":22968},{"style":264},[22969],{"type":30,"value":414},{"type":20,"tag":194,"props":22971,"children":22972},{"style":406},[22973],{"type":30,"value":4563},{"type":20,"tag":194,"props":22975,"children":22976},{"style":264},[22977],{"type":30,"value":4253},{"type":20,"tag":194,"props":22979,"children":22980},{"class":196,"line":552},[22981],{"type":20,"tag":194,"props":22982,"children":22983},{"style":201},[22984],{"type":30,"value":22985},"        // Test for the conditions that mean we can/want to send/receive blobs or arraybuffers - we need XMLHttpRequest\n",{"type":20,"tag":194,"props":22987,"children":22988},{"class":196,"line":598},[22989],{"type":20,"tag":194,"props":22990,"children":22991},{"style":201},[22992],{"type":30,"value":22993},"        // level 2 (so feature-detect against window.FormData), feature detect against window.Blob or window.ArrayBuffer,\n",{"type":20,"tag":194,"props":22995,"children":22996},{"class":196,"line":611},[22997],{"type":20,"tag":194,"props":22998,"children":22999},{"style":201},[23000],{"type":30,"value":23001},"        // and then check to see if the dataType is blob/arraybuffer or the data itself is a Blob/ArrayBuffer\n",{"type":20,"tag":194,"props":23003,"children":23004},{"class":196,"line":630},[23005,23009,23013,23017,23021,23025,23029,23033,23037,23041,23045,23049,23053],{"type":20,"tag":194,"props":23006,"children":23007},{"style":252},[23008],{"type":30,"value":1782},{"type":20,"tag":194,"props":23010,"children":23011},{"style":264},[23012],{"type":30,"value":21626},{"type":20,"tag":194,"props":23014,"children":23015},{"style":252},[23016],{"type":30,"value":1920},{"type":20,"tag":194,"props":23018,"children":23019},{"style":264},[23020],{"type":30,"value":21635},{"type":20,"tag":194,"props":23022,"children":23023},{"style":252},[23024],{"type":30,"value":1920},{"type":20,"tag":194,"props":23026,"children":23027},{"style":264},[23028],{"type":30,"value":21644},{"type":20,"tag":194,"props":23030,"children":23031},{"style":252},[23032],{"type":30,"value":7544},{"type":20,"tag":194,"props":23034,"children":23035},{"style":506},[23036],{"type":30,"value":21331},{"type":20,"tag":194,"props":23038,"children":23039},{"style":252},[23040],{"type":30,"value":5181},{"type":20,"tag":194,"props":23042,"children":23043},{"style":264},[23044],{"type":30,"value":21661},{"type":20,"tag":194,"props":23046,"children":23047},{"style":252},[23048],{"type":30,"value":7544},{"type":20,"tag":194,"props":23050,"children":23051},{"style":506},[23052],{"type":30,"value":21670},{"type":20,"tag":194,"props":23054,"children":23055},{"style":264},[23056],{"type":30,"value":21675},{"type":20,"tag":194,"props":23058,"children":23059},{"class":196,"line":713},[23060,23064,23068,23072,23076,23080,23084,23088,23092],{"type":20,"tag":194,"props":23061,"children":23062},{"style":252},[23063],{"type":30,"value":21725},{"type":20,"tag":194,"props":23065,"children":23066},{"style":264},[23067],{"type":30,"value":12285},{"type":20,"tag":194,"props":23069,"children":23070},{"style":252},[23071],{"type":30,"value":1920},{"type":20,"tag":194,"props":23073,"children":23074},{"style":264},[23075],{"type":30,"value":21696},{"type":20,"tag":194,"props":23077,"children":23078},{"style":252},[23079],{"type":30,"value":1920},{"type":20,"tag":194,"props":23081,"children":23082},{"style":264},[23083],{"type":30,"value":21705},{"type":20,"tag":194,"props":23085,"children":23086},{"style":252},[23087],{"type":30,"value":17460},{"type":20,"tag":194,"props":23089,"children":23090},{"style":258},[23091],{"type":30,"value":15068},{"type":20,"tag":194,"props":23093,"children":23094},{"style":264},[23095],{"type":30,"value":5702},{"type":20,"tag":194,"props":23097,"children":23098},{"class":196,"line":743},[23099,23104,23108,23112,23116,23120,23124],{"type":20,"tag":194,"props":23100,"children":23101},{"style":252},[23102],{"type":30,"value":23103},"                ||",{"type":20,"tag":194,"props":23105,"children":23106},{"style":264},[23107],{"type":30,"value":21730},{"type":20,"tag":194,"props":23109,"children":23110},{"style":252},[23111],{"type":30,"value":1920},{"type":20,"tag":194,"props":23113,"children":23114},{"style":264},[23115],{"type":30,"value":21705},{"type":20,"tag":194,"props":23117,"children":23118},{"style":252},[23119],{"type":30,"value":17460},{"type":20,"tag":194,"props":23121,"children":23122},{"style":258},[23123],{"type":30,"value":21747},{"type":20,"tag":194,"props":23125,"children":23126},{"style":264},[23127],{"type":30,"value":21752},{"type":20,"tag":194,"props":23129,"children":23130},{"class":196,"line":762},[23131],{"type":20,"tag":194,"props":23132,"children":23133},{"style":264},[23134],{"type":30,"value":23135},"            ))\n",{"type":20,"tag":194,"props":23137,"children":23138},{"class":196,"line":771},[23139],{"type":20,"tag":194,"props":23140,"children":23141},{"style":264},[23142],{"type":30,"value":1057},{"type":20,"tag":194,"props":23144,"children":23145},{"class":196,"line":785},[23146,23150],{"type":20,"tag":194,"props":23147,"children":23148},{"style":252},[23149],{"type":30,"value":7360},{"type":20,"tag":194,"props":23151,"children":23152},{"style":264},[23153],{"type":30,"value":23154}," xhr;\n",{"type":20,"tag":194,"props":23156,"children":23157},{"class":196,"line":818},[23158],{"type":20,"tag":194,"props":23159,"children":23160},{"emptyLinePlaceholder":546},[23161],{"type":30,"value":549},{"type":20,"tag":194,"props":23163,"children":23164},{"class":196,"line":827},[23165,23169],{"type":20,"tag":194,"props":23166,"children":23167},{"style":252},[23168],{"type":30,"value":1943},{"type":20,"tag":194,"props":23170,"children":23171},{"style":264},[23172],{"type":30,"value":595},{"type":20,"tag":194,"props":23174,"children":23175},{"class":196,"line":836},[23176],{"type":20,"tag":194,"props":23177,"children":23178},{"style":201},[23179],{"type":30,"value":14361},{"type":20,"tag":194,"props":23181,"children":23182},{"class":196,"line":844},[23183],{"type":20,"tag":194,"props":23184,"children":23185},{"style":201},[23186],{"type":30,"value":23187},"                 * Return a transport capable of sending and/or receiving blobs - in this case, we instantiate\n",{"type":20,"tag":194,"props":23189,"children":23190},{"class":196,"line":858},[23191],{"type":20,"tag":194,"props":23192,"children":23193},{"style":201},[23194],{"type":30,"value":23195},"                 * a new XMLHttpRequest and use it to actually perform the request, and funnel the result back\n",{"type":20,"tag":194,"props":23197,"children":23198},{"class":196,"line":1726},[23199],{"type":20,"tag":194,"props":23200,"children":23201},{"style":201},[23202],{"type":30,"value":23203},"                 * into the jquery complete callback (such as the success function, done blocks, etc.)\n",{"type":20,"tag":194,"props":23205,"children":23206},{"class":196,"line":1743},[23207],{"type":20,"tag":194,"props":23208,"children":23209},{"style":201},[23210],{"type":30,"value":23211},"                 *\n",{"type":20,"tag":194,"props":23213,"children":23214},{"class":196,"line":1751},[23215,23220,23224],{"type":20,"tag":194,"props":23216,"children":23217},{"style":201},[23218],{"type":30,"value":23219},"                 * ",{"type":20,"tag":194,"props":23221,"children":23222},{"style":252},[23223],{"type":30,"value":255},{"type":20,"tag":194,"props":23225,"children":23226},{"style":264},[23227],{"type":30,"value":23228}," headers\n",{"type":20,"tag":194,"props":23230,"children":23231},{"class":196,"line":1776},[23232,23236,23240],{"type":20,"tag":194,"props":23233,"children":23234},{"style":201},[23235],{"type":30,"value":23219},{"type":20,"tag":194,"props":23237,"children":23238},{"style":252},[23239],{"type":30,"value":255},{"type":20,"tag":194,"props":23241,"children":23242},{"style":264},[23243],{"type":30,"value":23244}," completeCallback\n",{"type":20,"tag":194,"props":23246,"children":23247},{"class":196,"line":1811},[23248],{"type":20,"tag":194,"props":23249,"children":23250},{"style":201},[23251],{"type":30,"value":14393},{"type":20,"tag":194,"props":23253,"children":23254},{"class":196,"line":1847},[23255,23260,23264,23268,23272,23276,23280,23284],{"type":20,"tag":194,"props":23256,"children":23257},{"style":258},[23258],{"type":30,"value":23259},"                send",{"type":20,"tag":194,"props":23261,"children":23262},{"style":264},[23263],{"type":30,"value":5035},{"type":20,"tag":194,"props":23265,"children":23266},{"style":252},[23267],{"type":30,"value":393},{"type":20,"tag":194,"props":23269,"children":23270},{"style":264},[23271],{"type":30,"value":403},{"type":20,"tag":194,"props":23273,"children":23274},{"style":406},[23275],{"type":30,"value":1501},{"type":20,"tag":194,"props":23277,"children":23278},{"style":264},[23279],{"type":30,"value":414},{"type":20,"tag":194,"props":23281,"children":23282},{"style":406},[23283],{"type":30,"value":14437},{"type":20,"tag":194,"props":23285,"children":23286},{"style":264},[23287],{"type":30,"value":4253},{"type":20,"tag":194,"props":23289,"children":23290},{"class":196,"line":1901},[23291,23295,23299,23303,23307,23311],{"type":20,"tag":194,"props":23292,"children":23293},{"style":252},[23294],{"type":30,"value":19597},{"type":20,"tag":194,"props":23296,"children":23297},{"style":264},[23298],{"type":30,"value":1605},{"type":20,"tag":194,"props":23300,"children":23301},{"style":252},[23302],{"type":30,"value":461},{"type":20,"tag":194,"props":23304,"children":23305},{"style":264},[23306],{"type":30,"value":21903},{"type":20,"tag":194,"props":23308,"children":23309},{"style":252},[23310],{"type":30,"value":519},{"type":20,"tag":194,"props":23312,"children":23313},{"style":264},[23314],{"type":30,"value":21912},{"type":20,"tag":194,"props":23316,"children":23317},{"class":196,"line":1937},[23318,23323,23327,23331,23335,23339],{"type":20,"tag":194,"props":23319,"children":23320},{"style":264},[23321],{"type":30,"value":23322},"                        type ",{"type":20,"tag":194,"props":23324,"children":23325},{"style":252},[23326],{"type":30,"value":461},{"type":20,"tag":194,"props":23328,"children":23329},{"style":264},[23330],{"type":30,"value":12276},{"type":20,"tag":194,"props":23332,"children":23333},{"style":252},[23334],{"type":30,"value":519},{"type":20,"tag":194,"props":23336,"children":23337},{"style":506},[23338],{"type":30,"value":21937},{"type":20,"tag":194,"props":23340,"children":23341},{"style":264},[23342],{"type":30,"value":1075},{"type":20,"tag":194,"props":23344,"children":23345},{"class":196,"line":1951},[23346,23351,23355,23359,23363,23367],{"type":20,"tag":194,"props":23347,"children":23348},{"style":264},[23349],{"type":30,"value":23350},"                        dataType ",{"type":20,"tag":194,"props":23352,"children":23353},{"style":252},[23354],{"type":30,"value":461},{"type":20,"tag":194,"props":23356,"children":23357},{"style":264},[23358],{"type":30,"value":21661},{"type":20,"tag":194,"props":23360,"children":23361},{"style":252},[23362],{"type":30,"value":519},{"type":20,"tag":194,"props":23364,"children":23365},{"style":506},[23366],{"type":30,"value":21966},{"type":20,"tag":194,"props":23368,"children":23369},{"style":264},[23370],{"type":30,"value":1075},{"type":20,"tag":194,"props":23372,"children":23373},{"class":196,"line":1959},[23374,23379,23383,23387,23391,23395],{"type":20,"tag":194,"props":23375,"children":23376},{"style":264},[23377],{"type":30,"value":23378},"                        data ",{"type":20,"tag":194,"props":23380,"children":23381},{"style":252},[23382],{"type":30,"value":461},{"type":20,"tag":194,"props":23384,"children":23385},{"style":264},[23386],{"type":30,"value":21705},{"type":20,"tag":194,"props":23388,"children":23389},{"style":252},[23390],{"type":30,"value":519},{"type":20,"tag":194,"props":23392,"children":23393},{"style":680},[23394],{"type":30,"value":21995},{"type":20,"tag":194,"props":23396,"children":23397},{"style":264},[23398],{"type":30,"value":1075},{"type":20,"tag":194,"props":23400,"children":23401},{"class":196,"line":1991},[23402,23407,23411,23415,23419,23423],{"type":20,"tag":194,"props":23403,"children":23404},{"style":264},[23405],{"type":30,"value":23406},"                        async ",{"type":20,"tag":194,"props":23408,"children":23409},{"style":252},[23410],{"type":30,"value":461},{"type":20,"tag":194,"props":23412,"children":23413},{"style":264},[23414],{"type":30,"value":22016},{"type":20,"tag":194,"props":23416,"children":23417},{"style":252},[23418],{"type":30,"value":519},{"type":20,"tag":194,"props":23420,"children":23421},{"style":680},[23422],{"type":30,"value":1831},{"type":20,"tag":194,"props":23424,"children":23425},{"style":264},[23426],{"type":30,"value":1384},{"type":20,"tag":194,"props":23428,"children":23429},{"class":196,"line":2004},[23430],{"type":20,"tag":194,"props":23431,"children":23432},{"emptyLinePlaceholder":546},[23433],{"type":30,"value":549},{"type":20,"tag":194,"props":23435,"children":23436},{"class":196,"line":2012},[23437,23442,23446,23450,23454],{"type":20,"tag":194,"props":23438,"children":23439},{"style":264},[23440],{"type":30,"value":23441},"                    xhr ",{"type":20,"tag":194,"props":23443,"children":23444},{"style":252},[23445],{"type":30,"value":461},{"type":20,"tag":194,"props":23447,"children":23448},{"style":252},[23449],{"type":30,"value":1031},{"type":20,"tag":194,"props":23451,"children":23452},{"style":258},[23453],{"type":30,"value":4075},{"type":20,"tag":194,"props":23455,"children":23456},{"style":264},[23457],{"type":30,"value":539},{"type":20,"tag":194,"props":23459,"children":23460},{"class":196,"line":2020},[23461,23466,23470,23474,23478,23482,23486],{"type":20,"tag":194,"props":23462,"children":23463},{"style":264},[23464],{"type":30,"value":23465},"                    xhr.",{"type":20,"tag":194,"props":23467,"children":23468},{"style":258},[23469],{"type":30,"value":4099},{"type":20,"tag":194,"props":23471,"children":23472},{"style":264},[23473],{"type":30,"value":403},{"type":20,"tag":194,"props":23475,"children":23476},{"style":506},[23477],{"type":30,"value":4108},{"type":20,"tag":194,"props":23479,"children":23480},{"style":264},[23481],{"type":30,"value":414},{"type":20,"tag":194,"props":23483,"children":23484},{"style":252},[23485],{"type":30,"value":393},{"type":20,"tag":194,"props":23487,"children":23488},{"style":264},[23489],{"type":30,"value":4121},{"type":20,"tag":194,"props":23491,"children":23492},{"class":196,"line":2028},[23493,23498,23502,23506],{"type":20,"tag":194,"props":23494,"children":23495},{"style":252},[23496],{"type":30,"value":23497},"                        var",{"type":20,"tag":194,"props":23499,"children":23500},{"style":264},[23501],{"type":30,"value":7365},{"type":20,"tag":194,"props":23503,"children":23504},{"style":252},[23505],{"type":30,"value":461},{"type":20,"tag":194,"props":23507,"children":23508},{"style":264},[23509],{"type":30,"value":18519},{"type":20,"tag":194,"props":23511,"children":23512},{"class":196,"line":2037},[23513,23518,23522,23527,23532,23536,23540,23544,23548,23553,23557,23561,23565,23570],{"type":20,"tag":194,"props":23514,"children":23515},{"style":264},[23516],{"type":30,"value":23517},"                            success ",{"type":20,"tag":194,"props":23519,"children":23520},{"style":252},[23521],{"type":30,"value":461},{"type":20,"tag":194,"props":23523,"children":23524},{"style":264},[23525],{"type":30,"value":23526}," xhr.status ",{"type":20,"tag":194,"props":23528,"children":23529},{"style":252},[23530],{"type":30,"value":23531},">=",{"type":20,"tag":194,"props":23533,"children":23534},{"style":680},[23535],{"type":30,"value":5176},{"type":20,"tag":194,"props":23537,"children":23538},{"style":252},[23539],{"type":30,"value":1880},{"type":20,"tag":194,"props":23541,"children":23542},{"style":264},[23543],{"type":30,"value":23526},{"type":20,"tag":194,"props":23545,"children":23546},{"style":252},[23547],{"type":30,"value":3674},{"type":20,"tag":194,"props":23549,"children":23550},{"style":680},[23551],{"type":30,"value":23552}," 300",{"type":20,"tag":194,"props":23554,"children":23555},{"style":252},[23556],{"type":30,"value":5181},{"type":20,"tag":194,"props":23558,"children":23559},{"style":264},[23560],{"type":30,"value":23526},{"type":20,"tag":194,"props":23562,"children":23563},{"style":252},[23564],{"type":30,"value":1826},{"type":20,"tag":194,"props":23566,"children":23567},{"style":680},[23568],{"type":30,"value":23569}," 304",{"type":20,"tag":194,"props":23571,"children":23572},{"style":264},[23573],{"type":30,"value":1384},{"type":20,"tag":194,"props":23575,"children":23576},{"class":196,"line":2045},[23577],{"type":20,"tag":194,"props":23578,"children":23579},{"emptyLinePlaceholder":546},[23580],{"type":30,"value":549},{"type":20,"tag":194,"props":23582,"children":23583},{"class":196,"line":2066},[23584,23589],{"type":20,"tag":194,"props":23585,"children":23586},{"style":252},[23587],{"type":30,"value":23588},"                        if",{"type":20,"tag":194,"props":23590,"children":23591},{"style":264},[23592],{"type":30,"value":23593}," (success){\n",{"type":20,"tag":194,"props":23595,"children":23596},{"class":196,"line":2087},[23597,23602,23606],{"type":20,"tag":194,"props":23598,"children":23599},{"style":264},[23600],{"type":30,"value":23601},"                            res[dataType] ",{"type":20,"tag":194,"props":23603,"children":23604},{"style":252},[23605],{"type":30,"value":461},{"type":20,"tag":194,"props":23607,"children":23608},{"style":264},[23609],{"type":30,"value":22110},{"type":20,"tag":194,"props":23611,"children":23612},{"class":196,"line":2095},[23613,23618,23623],{"type":20,"tag":194,"props":23614,"children":23615},{"style":264},[23616],{"type":30,"value":23617},"                        } ",{"type":20,"tag":194,"props":23619,"children":23620},{"style":252},[23621],{"type":30,"value":23622},"else",{"type":20,"tag":194,"props":23624,"children":23625},{"style":264},[23626],{"type":30,"value":595},{"type":20,"tag":194,"props":23628,"children":23629},{"class":196,"line":2128},[23630,23635,23639],{"type":20,"tag":194,"props":23631,"children":23632},{"style":264},[23633],{"type":30,"value":23634},"                            res.text ",{"type":20,"tag":194,"props":23636,"children":23637},{"style":252},[23638],{"type":30,"value":461},{"type":20,"tag":194,"props":23640,"children":23641},{"style":264},[23642],{"type":30,"value":23643}," xhr.statusText;\n",{"type":20,"tag":194,"props":23645,"children":23646},{"class":196,"line":2147},[23647],{"type":20,"tag":194,"props":23648,"children":23649},{"style":264},[23650],{"type":30,"value":23651},"                        }\n",{"type":20,"tag":194,"props":23653,"children":23654},{"class":196,"line":2175},[23655],{"type":20,"tag":194,"props":23656,"children":23657},{"emptyLinePlaceholder":546},[23658],{"type":30,"value":549},{"type":20,"tag":194,"props":23660,"children":23661},{"class":196,"line":2203},[23662,23667,23671,23675],{"type":20,"tag":194,"props":23663,"children":23664},{"style":258},[23665],{"type":30,"value":23666},"                        completeCallback",{"type":20,"tag":194,"props":23668,"children":23669},{"style":264},[23670],{"type":30,"value":22123},{"type":20,"tag":194,"props":23672,"children":23673},{"style":258},[23674],{"type":30,"value":22128},{"type":20,"tag":194,"props":23676,"children":23677},{"style":264},[23678],{"type":30,"value":22133},{"type":20,"tag":194,"props":23680,"children":23681},{"class":196,"line":2211},[23682],{"type":20,"tag":194,"props":23683,"children":23684},{"style":264},[23685],{"type":30,"value":23686},"                    });\n",{"type":20,"tag":194,"props":23688,"children":23689},{"class":196,"line":2219},[23690],{"type":20,"tag":194,"props":23691,"children":23692},{"emptyLinePlaceholder":546},[23693],{"type":30,"value":549},{"type":20,"tag":194,"props":23695,"children":23696},{"class":196,"line":2227},[23697,23701,23705],{"type":20,"tag":194,"props":23698,"children":23699},{"style":264},[23700],{"type":30,"value":23465},{"type":20,"tag":194,"props":23702,"children":23703},{"style":258},[23704],{"type":30,"value":4325},{"type":20,"tag":194,"props":23706,"children":23707},{"style":264},[23708],{"type":30,"value":22163},{"type":20,"tag":194,"props":23710,"children":23711},{"class":196,"line":2236},[23712,23717,23721],{"type":20,"tag":194,"props":23713,"children":23714},{"style":264},[23715],{"type":30,"value":23716},"                    xhr.responseType ",{"type":20,"tag":194,"props":23718,"children":23719},{"style":252},[23720],{"type":30,"value":461},{"type":20,"tag":194,"props":23722,"children":23723},{"style":264},[23724],{"type":30,"value":22180},{"type":20,"tag":194,"props":23726,"children":23727},{"class":196,"line":2245},[23728],{"type":20,"tag":194,"props":23729,"children":23730},{"emptyLinePlaceholder":546},[23731],{"type":30,"value":549},{"type":20,"tag":194,"props":23733,"children":23734},{"class":196,"line":2254},[23735,23740,23744,23748,23753,23758],{"type":20,"tag":194,"props":23736,"children":23737},{"style":252},[23738],{"type":30,"value":23739},"                    for",{"type":20,"tag":194,"props":23741,"children":23742},{"style":264},[23743],{"type":30,"value":1172},{"type":20,"tag":194,"props":23745,"children":23746},{"style":252},[23747],{"type":30,"value":4057},{"type":20,"tag":194,"props":23749,"children":23750},{"style":264},[23751],{"type":30,"value":23752}," key ",{"type":20,"tag":194,"props":23754,"children":23755},{"style":252},[23756],{"type":30,"value":23757},"in",{"type":20,"tag":194,"props":23759,"children":23760},{"style":264},[23761],{"type":30,"value":23762}," headers){\n",{"type":20,"tag":194,"props":23764,"children":23765},{"class":196,"line":2262},[23766,23770,23775,23780],{"type":20,"tag":194,"props":23767,"children":23768},{"style":252},[23769],{"type":30,"value":23588},{"type":20,"tag":194,"props":23771,"children":23772},{"style":264},[23773],{"type":30,"value":23774}," (headers.",{"type":20,"tag":194,"props":23776,"children":23777},{"style":258},[23778],{"type":30,"value":23779},"hasOwnProperty",{"type":20,"tag":194,"props":23781,"children":23782},{"style":264},[23783],{"type":30,"value":23784},"(key)){\n",{"type":20,"tag":194,"props":23786,"children":23787},{"class":196,"line":2286},[23788,23793,23798],{"type":20,"tag":194,"props":23789,"children":23790},{"style":264},[23791],{"type":30,"value":23792},"                            xhr.",{"type":20,"tag":194,"props":23794,"children":23795},{"style":258},[23796],{"type":30,"value":23797},"setRequestHeader",{"type":20,"tag":194,"props":23799,"children":23800},{"style":264},[23801],{"type":30,"value":23802},"(key, headers[key]);\n",{"type":20,"tag":194,"props":23804,"children":23805},{"class":196,"line":2295},[23806],{"type":20,"tag":194,"props":23807,"children":23808},{"style":264},[23809],{"type":30,"value":23651},{"type":20,"tag":194,"props":23811,"children":23812},{"class":196,"line":2319},[23813],{"type":20,"tag":194,"props":23814,"children":23815},{"style":264},[23816],{"type":30,"value":14701},{"type":20,"tag":194,"props":23818,"children":23819},{"class":196,"line":2328},[23820],{"type":20,"tag":194,"props":23821,"children":23822},{"emptyLinePlaceholder":546},[23823],{"type":30,"value":549},{"type":20,"tag":194,"props":23825,"children":23826},{"class":196,"line":2352},[23827,23831,23835],{"type":20,"tag":194,"props":23828,"children":23829},{"style":264},[23830],{"type":30,"value":23465},{"type":20,"tag":194,"props":23832,"children":23833},{"style":258},[23834],{"type":30,"value":4368},{"type":20,"tag":194,"props":23836,"children":23837},{"style":264},[23838],{"type":30,"value":22196},{"type":20,"tag":194,"props":23840,"children":23841},{"class":196,"line":2361},[23842],{"type":20,"tag":194,"props":23843,"children":23844},{"style":264},[23845],{"type":30,"value":23846},"                },\n",{"type":20,"tag":194,"props":23848,"children":23849},{"class":196,"line":2381},[23850,23855,23859,23863],{"type":20,"tag":194,"props":23851,"children":23852},{"style":258},[23853],{"type":30,"value":23854},"                abort",{"type":20,"tag":194,"props":23856,"children":23857},{"style":264},[23858],{"type":30,"value":5035},{"type":20,"tag":194,"props":23860,"children":23861},{"style":252},[23862],{"type":30,"value":393},{"type":20,"tag":194,"props":23864,"children":23865},{"style":264},[23866],{"type":30,"value":4121},{"type":20,"tag":194,"props":23868,"children":23869},{"class":196,"line":2389},[23870,23874],{"type":20,"tag":194,"props":23871,"children":23872},{"style":252},[23873],{"type":30,"value":14015},{"type":20,"tag":194,"props":23875,"children":23876},{"style":264},[23877],{"type":30,"value":23878}," (xhr){\n",{"type":20,"tag":194,"props":23880,"children":23881},{"class":196,"line":2437},[23882,23887,23891],{"type":20,"tag":194,"props":23883,"children":23884},{"style":264},[23885],{"type":30,"value":23886},"                        xhr.",{"type":20,"tag":194,"props":23888,"children":23889},{"style":258},[23890],{"type":30,"value":22237},{"type":20,"tag":194,"props":23892,"children":23893},{"style":264},[23894],{"type":30,"value":539},{"type":20,"tag":194,"props":23896,"children":23897},{"class":196,"line":2465},[23898],{"type":20,"tag":194,"props":23899,"children":23900},{"style":264},[23901],{"type":30,"value":14701},{"type":20,"tag":194,"props":23903,"children":23904},{"class":196,"line":2518},[23905],{"type":20,"tag":194,"props":23906,"children":23907},{"style":264},[23908],{"type":30,"value":3048},{"type":20,"tag":194,"props":23910,"children":23911},{"class":196,"line":2526},[23912],{"type":20,"tag":194,"props":23913,"children":23914},{"style":264},[23915],{"type":30,"value":9724},{"type":20,"tag":194,"props":23917,"children":23918},{"class":196,"line":2567},[23919],{"type":20,"tag":194,"props":23920,"children":23921},{"style":264},[23922],{"type":30,"value":824},{"type":20,"tag":194,"props":23924,"children":23925},{"class":196,"line":2580},[23926],{"type":20,"tag":194,"props":23927,"children":23928},{"style":264},[23929],{"type":30,"value":833},{"type":20,"tag":194,"props":23931,"children":23932},{"class":196,"line":2597},[23933],{"type":20,"tag":194,"props":23934,"children":23935},{"style":264},[23936],{"type":30,"value":18219},{"type":20,"tag":21,"props":23938,"children":23939},{},[23940,23947],{"type":20,"tag":25,"props":23941,"children":23945},{"href":23942,"rel":23943,"title":23944},"https://gist.github.com/SaneMethod/7548768/",[50],"You can also find it here",[23946],{"type":30,"value":23944},{"type":30,"value":55},{"type":20,"tag":3951,"props":23949,"children":23950},{},[23951],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":23953},[],"content:ckeefer:2013-11:jquery-ajax-blobs.md","ckeefer/2013-11/jquery-ajax-blobs.md","ckeefer/2013-11/jquery-ajax-blobs",{"user":3970,"name":3971},{"_path":23959,"_dir":23960,"_draft":7,"_partial":7,"_locale":8,"title":23961,"description":23962,"publishDate":23963,"categories":23964,"tags":23966,"image":23968,"excerpt":23962,"body":23969,"_type":3963,"_id":27381,"_source":3965,"_file":27382,"_stem":27383,"_extension":3968,"author":27384},"/ckeefer/2013-3/ajax-upload","2013-3","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",[23965],"developer-blog",[13,14,23967],"html5","/ckeefer/2013-3/img/upframe.jpg",{"type":17,"children":23970,"toc":27374},[23971,23985,24008,24013,24018,24024,24029,24034,24226,24231,24583,24588,24594,24599,24613,24736,24748,24754,24759,25023,25035,25195,25200,25578,25583,25902,25907,25913,25918,25924,25929,27370],{"type":20,"tag":21,"props":23972,"children":23973},{},[23974,23976,23983],{"type":30,"value":23975},"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":20,"tag":25,"props":23977,"children":23980},{"href":23978,"rel":23979},"http://beta.photobucket.com/img/mold+spores/",[50],[23981],{"type":30,"value":23982},"someone, somewhere",{"type":30,"value":23984}," will want to share detailed photographic evidence of their mold problem. The need to upload files is a given.",{"type":20,"tag":21,"props":23986,"children":23987},{},[23988,23990,23997,23999,24006],{"type":30,"value":23989},"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":20,"tag":25,"props":23991,"children":23994},{"href":23992,"rel":23993},"http://www.w3.org/TR/XMLHttpRequest2/",[50],[23995],{"type":30,"value":23996},"This is changing",{"type":30,"value":23998}," – with the new XMLHttpRequest level 2 spec, coupled with the ",{"type":20,"tag":25,"props":24000,"children":24003},{"href":24001,"rel":24002},"http://www.w3.org/TR/FileAPI/",[50],[24004],{"type":30,"value":24005},"File API",{"type":30,"value":24007},", 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":20,"tag":21,"props":24009,"children":24010},{},[24011],{"type":30,"value":24012},"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":20,"tag":21,"props":24014,"children":24015},{},[24016],{"type":30,"value":24017},"Aha, I say – its time for a little iframe trick, then.",{"type":20,"tag":5510,"props":24019,"children":24021},{"id":24020},"the-trick",[24022],{"type":30,"value":24023},"The Trick",{"type":20,"tag":21,"props":24025,"children":24026},{},[24027],{"type":30,"value":24028},"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":20,"tag":21,"props":24030,"children":24031},{},[24032],{"type":30,"value":24033},"Say you have a form like this:",{"type":20,"tag":184,"props":24035,"children":24037},{"className":6633,"code":24036,"language":6635,"meta":8,"style":8},"\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",[24038],{"type":20,"tag":68,"props":24039,"children":24040},{"__ignoreMap":8},[24041,24111,24169,24210],{"type":20,"tag":194,"props":24042,"children":24043},{"class":196,"line":197},[24044,24048,24052,24056,24060,24065,24070,24074,24079,24084,24088,24093,24098,24102,24107],{"type":20,"tag":194,"props":24045,"children":24046},{"style":264},[24047],{"type":30,"value":3674},{"type":20,"tag":194,"props":24049,"children":24050},{"style":6650},[24051],{"type":30,"value":6678},{"type":20,"tag":194,"props":24053,"children":24054},{"style":258},[24055],{"type":30,"value":6700},{"type":20,"tag":194,"props":24057,"children":24058},{"style":264},[24059],{"type":30,"value":461},{"type":20,"tag":194,"props":24061,"children":24062},{"style":506},[24063],{"type":30,"value":24064},"\"uploadForm\"",{"type":20,"tag":194,"props":24066,"children":24067},{"style":258},[24068],{"type":30,"value":24069}," action",{"type":20,"tag":194,"props":24071,"children":24072},{"style":264},[24073],{"type":30,"value":461},{"type":20,"tag":194,"props":24075,"children":24076},{"style":506},[24077],{"type":30,"value":24078},"\"/upload/url\"",{"type":20,"tag":194,"props":24080,"children":24081},{"style":258},[24082],{"type":30,"value":24083}," enctype",{"type":20,"tag":194,"props":24085,"children":24086},{"style":264},[24087],{"type":30,"value":461},{"type":20,"tag":194,"props":24089,"children":24090},{"style":506},[24091],{"type":30,"value":24092},"\"multipart/form-data\"",{"type":20,"tag":194,"props":24094,"children":24095},{"style":258},[24096],{"type":30,"value":24097}," method",{"type":20,"tag":194,"props":24099,"children":24100},{"style":264},[24101],{"type":30,"value":461},{"type":20,"tag":194,"props":24103,"children":24104},{"style":506},[24105],{"type":30,"value":24106},"\"POST\"",{"type":20,"tag":194,"props":24108,"children":24109},{"style":264},[24110],{"type":30,"value":6658},{"type":20,"tag":194,"props":24112,"children":24113},{"class":196,"line":207},[24114,24118,24123,24127,24131,24136,24141,24145,24150,24155,24159,24164],{"type":20,"tag":194,"props":24115,"children":24116},{"style":264},[24117],{"type":30,"value":6647},{"type":20,"tag":194,"props":24119,"children":24120},{"style":6650},[24121],{"type":30,"value":24122},"input",{"type":20,"tag":194,"props":24124,"children":24125},{"style":258},[24126],{"type":30,"value":6746},{"type":20,"tag":194,"props":24128,"children":24129},{"style":264},[24130],{"type":30,"value":461},{"type":20,"tag":194,"props":24132,"children":24133},{"style":506},[24134],{"type":30,"value":24135},"\"file\"",{"type":20,"tag":194,"props":24137,"children":24138},{"style":258},[24139],{"type":30,"value":24140}," name",{"type":20,"tag":194,"props":24142,"children":24143},{"style":264},[24144],{"type":30,"value":461},{"type":20,"tag":194,"props":24146,"children":24147},{"style":506},[24148],{"type":30,"value":24149},"\"uploadLocalImage\"",{"type":20,"tag":194,"props":24151,"children":24152},{"style":258},[24153],{"type":30,"value":24154}," accept",{"type":20,"tag":194,"props":24156,"children":24157},{"style":264},[24158],{"type":30,"value":461},{"type":20,"tag":194,"props":24160,"children":24161},{"style":506},[24162],{"type":30,"value":24163},"\"image/*\"",{"type":20,"tag":194,"props":24165,"children":24166},{"style":264},[24167],{"type":30,"value":24168}," />\n",{"type":20,"tag":194,"props":24170,"children":24171},{"class":196,"line":216},[24172,24176,24180,24184,24188,24192,24197,24201,24206],{"type":20,"tag":194,"props":24173,"children":24174},{"style":264},[24175],{"type":30,"value":6647},{"type":20,"tag":194,"props":24177,"children":24178},{"style":6650},[24179],{"type":30,"value":24122},{"type":20,"tag":194,"props":24181,"children":24182},{"style":258},[24183],{"type":30,"value":6746},{"type":20,"tag":194,"props":24185,"children":24186},{"style":264},[24187],{"type":30,"value":461},{"type":20,"tag":194,"props":24189,"children":24190},{"style":506},[24191],{"type":30,"value":6755},{"type":20,"tag":194,"props":24193,"children":24194},{"style":258},[24195],{"type":30,"value":24196}," value",{"type":20,"tag":194,"props":24198,"children":24199},{"style":264},[24200],{"type":30,"value":461},{"type":20,"tag":194,"props":24202,"children":24203},{"style":506},[24204],{"type":30,"value":24205},"\"Submit\"",{"type":20,"tag":194,"props":24207,"children":24208},{"style":264},[24209],{"type":30,"value":24168},{"type":20,"tag":194,"props":24211,"children":24212},{"class":196,"line":225},[24213,24218,24222],{"type":20,"tag":194,"props":24214,"children":24215},{"style":264},[24216],{"type":30,"value":24217},"\u003C/",{"type":20,"tag":194,"props":24219,"children":24220},{"style":6650},[24221],{"type":30,"value":6678},{"type":20,"tag":194,"props":24223,"children":24224},{"style":264},[24225],{"type":30,"value":6658},{"type":20,"tag":21,"props":24227,"children":24228},{},[24229],{"type":30,"value":24230},"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":20,"tag":184,"props":24232,"children":24234},{"className":186,"code":24233,"language":188,"meta":8,"style":8},"$('#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",[24235],{"type":20,"tag":68,"props":24236,"children":24237},{"__ignoreMap":8},[24238,24292,24300,24358,24365,24382,24409,24425,24440,24453,24484,24492,24507,24539,24547,24562,24569,24576],{"type":20,"tag":194,"props":24239,"children":24240},{"class":196,"line":197},[24241,24245,24249,24254,24258,24263,24267,24272,24276,24280,24284,24288],{"type":20,"tag":194,"props":24242,"children":24243},{"style":258},[24244],{"type":30,"value":6468},{"type":20,"tag":194,"props":24246,"children":24247},{"style":264},[24248],{"type":30,"value":403},{"type":20,"tag":194,"props":24250,"children":24251},{"style":506},[24252],{"type":30,"value":24253},"'#uploadForm'",{"type":20,"tag":194,"props":24255,"children":24256},{"style":264},[24257],{"type":30,"value":529},{"type":20,"tag":194,"props":24259,"children":24260},{"style":258},[24261],{"type":30,"value":24262},"on",{"type":20,"tag":194,"props":24264,"children":24265},{"style":264},[24266],{"type":30,"value":403},{"type":20,"tag":194,"props":24268,"children":24269},{"style":506},[24270],{"type":30,"value":24271},"'submit'",{"type":20,"tag":194,"props":24273,"children":24274},{"style":264},[24275],{"type":30,"value":414},{"type":20,"tag":194,"props":24277,"children":24278},{"style":252},[24279],{"type":30,"value":393},{"type":20,"tag":194,"props":24281,"children":24282},{"style":264},[24283],{"type":30,"value":403},{"type":20,"tag":194,"props":24285,"children":24286},{"style":406},[24287],{"type":30,"value":9497},{"type":20,"tag":194,"props":24289,"children":24290},{"style":264},[24291],{"type":30,"value":4253},{"type":20,"tag":194,"props":24293,"children":24294},{"class":196,"line":207},[24295],{"type":20,"tag":194,"props":24296,"children":24297},{"style":201},[24298],{"type":30,"value":24299},"// 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":20,"tag":194,"props":24301,"children":24302},{"class":196,"line":216},[24303,24307,24311,24315,24319,24323,24327,24332,24336,24341,24345,24349,24354],{"type":20,"tag":194,"props":24304,"children":24305},{"style":252},[24306],{"type":30,"value":21621},{"type":20,"tag":194,"props":24308,"children":24309},{"style":264},[24310],{"type":30,"value":1172},{"type":20,"tag":194,"props":24312,"children":24313},{"style":258},[24314],{"type":30,"value":6468},{"type":20,"tag":194,"props":24316,"children":24317},{"style":264},[24318],{"type":30,"value":403},{"type":20,"tag":194,"props":24320,"children":24321},{"style":680},[24322],{"type":30,"value":4174},{"type":20,"tag":194,"props":24324,"children":24325},{"style":264},[24326],{"type":30,"value":529},{"type":20,"tag":194,"props":24328,"children":24329},{"style":258},[24330],{"type":30,"value":24331},"attr",{"type":20,"tag":194,"props":24333,"children":24334},{"style":264},[24335],{"type":30,"value":403},{"type":20,"tag":194,"props":24337,"children":24338},{"style":506},[24339],{"type":30,"value":24340},"'target'",{"type":20,"tag":194,"props":24342,"children":24343},{"style":264},[24344],{"type":30,"value":514},{"type":20,"tag":194,"props":24346,"children":24347},{"style":252},[24348],{"type":30,"value":1826},{"type":20,"tag":194,"props":24350,"children":24351},{"style":680},[24352],{"type":30,"value":24353}," undefined",{"type":20,"tag":194,"props":24355,"children":24356},{"style":264},[24357],{"type":30,"value":5702},{"type":20,"tag":194,"props":24359,"children":24360},{"class":196,"line":225},[24361],{"type":20,"tag":194,"props":24362,"children":24363},{"style":264},[24364],{"type":30,"value":13056},{"type":20,"tag":194,"props":24366,"children":24367},{"class":196,"line":234},[24368,24373,24378],{"type":20,"tag":194,"props":24369,"children":24370},{"style":264},[24371],{"type":30,"value":24372},"    event.",{"type":20,"tag":194,"props":24374,"children":24375},{"style":258},[24376],{"type":30,"value":24377},"preventDefault",{"type":20,"tag":194,"props":24379,"children":24380},{"style":264},[24381],{"type":30,"value":539},{"type":20,"tag":194,"props":24383,"children":24384},{"class":196,"line":243},[24385,24390,24394,24399,24404],{"type":20,"tag":194,"props":24386,"children":24387},{"style":680},[24388],{"type":30,"value":24389},"    this",{"type":20,"tag":194,"props":24391,"children":24392},{"style":264},[24393],{"type":30,"value":55},{"type":20,"tag":194,"props":24395,"children":24396},{"style":258},[24397],{"type":30,"value":24398},"checkValidity",{"type":20,"tag":194,"props":24400,"children":24401},{"style":264},[24402],{"type":30,"value":24403},"(); ",{"type":20,"tag":194,"props":24405,"children":24406},{"style":201},[24407],{"type":30,"value":24408},"// 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":20,"tag":194,"props":24410,"children":24411},{"class":196,"line":275},[24412,24416,24421],{"type":20,"tag":194,"props":24413,"children":24414},{"style":264},[24415],{"type":30,"value":4427},{"type":20,"tag":194,"props":24417,"children":24418},{"style":258},[24419],{"type":30,"value":24420},"transparentSubmit",{"type":20,"tag":194,"props":24422,"children":24423},{"style":264},[24424],{"type":30,"value":4437},{"type":20,"tag":194,"props":24426,"children":24427},{"class":196,"line":284},[24428,24432,24436],{"type":20,"tag":194,"props":24429,"children":24430},{"style":264},[24431],{"type":30,"value":4478},{"type":20,"tag":194,"props":24433,"children":24434},{"style":506},[24435],{"type":30,"value":6378},{"type":20,"tag":194,"props":24437,"children":24438},{"style":264},[24439],{"type":30,"value":1075},{"type":20,"tag":194,"props":24441,"children":24442},{"class":196,"line":311},[24443,24448],{"type":20,"tag":194,"props":24444,"children":24445},{"style":264},[24446],{"type":30,"value":24447},"    form:",{"type":20,"tag":194,"props":24449,"children":24450},{"style":680},[24451],{"type":30,"value":24452},"this\n",{"type":20,"tag":194,"props":24454,"children":24455},{"class":196,"line":320},[24456,24460,24464,24468,24472,24476,24480],{"type":20,"tag":194,"props":24457,"children":24458},{"style":264},[24459],{"type":30,"value":4491},{"type":20,"tag":194,"props":24461,"children":24462},{"style":258},[24463],{"type":30,"value":4496},{"type":20,"tag":194,"props":24465,"children":24466},{"style":264},[24467],{"type":30,"value":403},{"type":20,"tag":194,"props":24469,"children":24470},{"style":252},[24471],{"type":30,"value":393},{"type":20,"tag":194,"props":24473,"children":24474},{"style":264},[24475],{"type":30,"value":403},{"type":20,"tag":194,"props":24477,"children":24478},{"style":406},[24479],{"type":30,"value":437},{"type":20,"tag":194,"props":24481,"children":24482},{"style":264},[24483],{"type":30,"value":4253},{"type":20,"tag":194,"props":24485,"children":24486},{"class":196,"line":347},[24487],{"type":20,"tag":194,"props":24488,"children":24489},{"style":201},[24490],{"type":30,"value":24491},"// Woo, completed successfully! Do something with the response.\n",{"type":20,"tag":194,"props":24493,"children":24494},{"class":196,"line":356},[24495,24499,24503],{"type":20,"tag":194,"props":24496,"children":24497},{"style":264},[24498],{"type":30,"value":4187},{"type":20,"tag":194,"props":24500,"children":24501},{"style":258},[24502],{"type":30,"value":796},{"type":20,"tag":194,"props":24504,"children":24505},{"style":264},[24506],{"type":30,"value":1203},{"type":20,"tag":194,"props":24508,"children":24509},{"class":196,"line":378},[24510,24514,24518,24522,24526,24530,24535],{"type":20,"tag":194,"props":24511,"children":24512},{"style":264},[24513],{"type":30,"value":4491},{"type":20,"tag":194,"props":24515,"children":24516},{"style":258},[24517],{"type":30,"value":4546},{"type":20,"tag":194,"props":24519,"children":24520},{"style":264},[24521],{"type":30,"value":403},{"type":20,"tag":194,"props":24523,"children":24524},{"style":252},[24525],{"type":30,"value":393},{"type":20,"tag":194,"props":24527,"children":24528},{"style":264},[24529],{"type":30,"value":403},{"type":20,"tag":194,"props":24531,"children":24532},{"style":406},[24533],{"type":30,"value":24534},"e",{"type":20,"tag":194,"props":24536,"children":24537},{"style":264},[24538],{"type":30,"value":4253},{"type":20,"tag":194,"props":24540,"children":24541},{"class":196,"line":387},[24542],{"type":20,"tag":194,"props":24543,"children":24544},{"style":201},[24545],{"type":30,"value":24546},"// Aww, our call failed. :( Do something with the failure message.\n",{"type":20,"tag":194,"props":24548,"children":24549},{"class":196,"line":445},[24550,24554,24558],{"type":20,"tag":194,"props":24551,"children":24552},{"style":264},[24553],{"type":30,"value":4187},{"type":20,"tag":194,"props":24555,"children":24556},{"style":258},[24557],{"type":30,"value":796},{"type":20,"tag":194,"props":24559,"children":24560},{"style":264},[24561],{"type":30,"value":13153},{"type":20,"tag":194,"props":24563,"children":24564},{"class":196,"line":479},[24565],{"type":20,"tag":194,"props":24566,"children":24567},{"style":264},[24568],{"type":30,"value":4204},{"type":20,"tag":194,"props":24570,"children":24571},{"class":196,"line":542},[24572],{"type":20,"tag":194,"props":24573,"children":24574},{"style":264},[24575],{"type":30,"value":864},{"type":20,"tag":194,"props":24577,"children":24578},{"class":196,"line":552},[24579],{"type":20,"tag":194,"props":24580,"children":24581},{"style":264},[24582],{"type":30,"value":4204},{"type":20,"tag":21,"props":24584,"children":24585},{},[24586],{"type":30,"value":24587},"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":20,"tag":5510,"props":24589,"children":24591},{"id":24590},"aside-deferred",[24592],{"type":30,"value":24593},"Aside: $.Deferred",{"type":20,"tag":21,"props":24595,"children":24596},{},[24597],{"type":30,"value":24598},"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":20,"tag":21,"props":24600,"children":24601},{},[24602,24604,24611],{"type":30,"value":24603},"This is all kinds of good, and could fill a post on its own (see ",{"type":20,"tag":25,"props":24605,"children":24608},{"href":24606,"rel":24607},"http://www.html5rocks.com/en/tutorials/async/deferred/",[50],[24609],{"type":30,"value":24610},"this post",{"type":30,"value":24612}," 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":20,"tag":184,"props":24614,"children":24616},{"className":186,"code":24615,"language":188,"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",[24617],{"type":20,"tag":68,"props":24618,"children":24619},{"__ignoreMap":8},[24620,24680,24721,24729],{"type":20,"tag":194,"props":24621,"children":24622},{"class":196,"line":197},[24623,24627,24631,24635,24639,24643,24648,24652,24656,24661,24665,24670,24675],{"type":20,"tag":194,"props":24624,"children":24625},{"style":264},[24626],{"type":30,"value":4427},{"type":20,"tag":194,"props":24628,"children":24629},{"style":258},[24630],{"type":30,"value":16593},{"type":20,"tag":194,"props":24632,"children":24633},{"style":264},[24634],{"type":30,"value":403},{"type":20,"tag":194,"props":24636,"children":24637},{"style":258},[24638],{"type":30,"value":6468},{"type":20,"tag":194,"props":24640,"children":24641},{"style":264},[24642],{"type":30,"value":403},{"type":20,"tag":194,"props":24644,"children":24645},{"style":506},[24646],{"type":30,"value":24647},"'#myForm'",{"type":20,"tag":194,"props":24649,"children":24650},{"style":264},[24651],{"type":30,"value":529},{"type":20,"tag":194,"props":24653,"children":24654},{"style":258},[24655],{"type":30,"value":24420},{"type":20,"tag":194,"props":24657,"children":24658},{"style":264},[24659],{"type":30,"value":24660},"({}), $.",{"type":20,"tag":194,"props":24662,"children":24663},{"style":258},[24664],{"type":30,"value":4432},{"type":20,"tag":194,"props":24666,"children":24667},{"style":264},[24668],{"type":30,"value":24669},"({url:",{"type":20,"tag":194,"props":24671,"children":24672},{"style":506},[24673],{"type":30,"value":24674},"'/ajax/page'",{"type":20,"tag":194,"props":24676,"children":24677},{"style":264},[24678],{"type":30,"value":24679},"}))\n",{"type":20,"tag":194,"props":24681,"children":24682},{"class":196,"line":207},[24683,24687,24691,24695,24699,24703,24708,24712,24717],{"type":20,"tag":194,"props":24684,"children":24685},{"style":264},[24686],{"type":30,"value":55},{"type":20,"tag":194,"props":24688,"children":24689},{"style":258},[24690],{"type":30,"value":4496},{"type":20,"tag":194,"props":24692,"children":24693},{"style":264},[24694],{"type":30,"value":403},{"type":20,"tag":194,"props":24696,"children":24697},{"style":252},[24698],{"type":30,"value":393},{"type":20,"tag":194,"props":24700,"children":24701},{"style":264},[24702],{"type":30,"value":403},{"type":20,"tag":194,"props":24704,"children":24705},{"style":406},[24706],{"type":30,"value":24707},"res1",{"type":20,"tag":194,"props":24709,"children":24710},{"style":264},[24711],{"type":30,"value":414},{"type":20,"tag":194,"props":24713,"children":24714},{"style":406},[24715],{"type":30,"value":24716},"res2",{"type":20,"tag":194,"props":24718,"children":24719},{"style":264},[24720],{"type":30,"value":4253},{"type":20,"tag":194,"props":24722,"children":24723},{"class":196,"line":216},[24724],{"type":20,"tag":194,"props":24725,"children":24726},{"style":201},[24727],{"type":30,"value":24728},"// Do something with the responses from both of our asynch calls\n",{"type":20,"tag":194,"props":24730,"children":24731},{"class":196,"line":225},[24732],{"type":20,"tag":194,"props":24733,"children":24734},{"style":264},[24735],{"type":30,"value":4204},{"type":20,"tag":21,"props":24737,"children":24738},{},[24739,24740,24746],{"type":30,"value":16055},{"type":20,"tag":25,"props":24741,"children":24743},{"href":15279,"rel":24742},[50],[24744],{"type":30,"value":24745},"jQuery docs",{"type":30,"value":24747}," for more details.",{"type":20,"tag":5510,"props":24749,"children":24751},{"id":24750},"breakdown",[24752],{"type":30,"value":24753},"Breakdown",{"type":20,"tag":21,"props":24755,"children":24756},{},[24757],{"type":30,"value":24758},"So just how does this transparentSubmit thing work, then? Let's go through it a few pieces at a time.",{"type":20,"tag":184,"props":24760,"children":24762},{"className":186,"code":24761,"language":188,"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",[24763],{"type":20,"tag":68,"props":24764,"children":24765},{"__ignoreMap":8},[24766,24793,24818,24829,24846,24917,24945,24966,24986,25003,25016],{"type":20,"tag":194,"props":24767,"children":24768},{"class":196,"line":197},[24769,24773,24777,24781,24785,24789],{"type":20,"tag":194,"props":24770,"children":24771},{"style":252},[24772],{"type":30,"value":4057},{"type":20,"tag":194,"props":24774,"children":24775},{"style":264},[24776],{"type":30,"value":10298},{"type":20,"tag":194,"props":24778,"children":24779},{"style":252},[24780],{"type":30,"value":461},{"type":20,"tag":194,"props":24782,"children":24783},{"style":264},[24784],{"type":30,"value":9118},{"type":20,"tag":194,"props":24786,"children":24787},{"style":258},[24788],{"type":30,"value":9123},{"type":20,"tag":194,"props":24790,"children":24791},{"style":264},[24792],{"type":30,"value":476},{"type":20,"tag":194,"props":24794,"children":24795},{"class":196,"line":207},[24796,24801,24805,24809,24814],{"type":20,"tag":194,"props":24797,"children":24798},{"style":264},[24799],{"type":30,"value":24800},"options ",{"type":20,"tag":194,"props":24802,"children":24803},{"style":252},[24804],{"type":30,"value":461},{"type":20,"tag":194,"props":24806,"children":24807},{"style":264},[24808],{"type":30,"value":9118},{"type":20,"tag":194,"props":24810,"children":24811},{"style":258},[24812],{"type":30,"value":24813},"extend",{"type":20,"tag":194,"props":24815,"children":24816},{"style":264},[24817],{"type":30,"value":4437},{"type":20,"tag":194,"props":24819,"children":24820},{"class":196,"line":216},[24821,24825],{"type":20,"tag":194,"props":24822,"children":24823},{"style":264},[24824],{"type":30,"value":4478},{"type":20,"tag":194,"props":24826,"children":24827},{"style":506},[24828],{"type":30,"value":4483},{"type":20,"tag":194,"props":24830,"children":24831},{"class":196,"line":225},[24832,24837,24841],{"type":20,"tag":194,"props":24833,"children":24834},{"style":264},[24835],{"type":30,"value":24836},"}, (options ",{"type":20,"tag":194,"props":24838,"children":24839},{"style":252},[24840],{"type":30,"value":519},{"type":20,"tag":194,"props":24842,"children":24843},{"style":264},[24844],{"type":30,"value":24845}," {})),\n",{"type":20,"tag":194,"props":24847,"children":24848},{"class":196,"line":234},[24849,24854,24858,24863,24867,24872,24877,24881,24886,24890,24895,24899,24904,24908,24913],{"type":20,"tag":194,"props":24850,"children":24851},{"style":264},[24852],{"type":30,"value":24853},"name ",{"type":20,"tag":194,"props":24855,"children":24856},{"style":252},[24857],{"type":30,"value":461},{"type":20,"tag":194,"props":24859,"children":24860},{"style":506},[24861],{"type":30,"value":24862}," 'target-'",{"type":20,"tag":194,"props":24864,"children":24865},{"style":252},[24866],{"type":30,"value":649},{"type":20,"tag":194,"props":24868,"children":24869},{"style":264},[24870],{"type":30,"value":24871},"Math.",{"type":20,"tag":194,"props":24873,"children":24874},{"style":258},[24875],{"type":30,"value":24876},"random",{"type":20,"tag":194,"props":24878,"children":24879},{"style":264},[24880],{"type":30,"value":567},{"type":20,"tag":194,"props":24882,"children":24883},{"style":258},[24884],{"type":30,"value":24885},"toString",{"type":20,"tag":194,"props":24887,"children":24888},{"style":264},[24889],{"type":30,"value":403},{"type":20,"tag":194,"props":24891,"children":24892},{"style":680},[24893],{"type":30,"value":24894},"36",{"type":20,"tag":194,"props":24896,"children":24897},{"style":264},[24898],{"type":30,"value":529},{"type":20,"tag":194,"props":24900,"children":24901},{"style":258},[24902],{"type":30,"value":24903},"substring",{"type":20,"tag":194,"props":24905,"children":24906},{"style":264},[24907],{"type":30,"value":403},{"type":20,"tag":194,"props":24909,"children":24910},{"style":680},[24911],{"type":30,"value":24912},"7",{"type":20,"tag":194,"props":24914,"children":24915},{"style":264},[24916],{"type":30,"value":5651},{"type":20,"tag":194,"props":24918,"children":24919},{"class":196,"line":243},[24920,24925,24929,24933,24937,24941],{"type":20,"tag":194,"props":24921,"children":24922},{"style":264},[24923],{"type":30,"value":24924},"hiframe ",{"type":20,"tag":194,"props":24926,"children":24927},{"style":252},[24928],{"type":30,"value":461},{"type":20,"tag":194,"props":24930,"children":24931},{"style":258},[24932],{"type":30,"value":17465},{"type":20,"tag":194,"props":24934,"children":24935},{"style":264},[24936],{"type":30,"value":403},{"type":20,"tag":194,"props":24938,"children":24939},{"style":506},[24940],{"type":30,"value":12112},{"type":20,"tag":194,"props":24942,"children":24943},{"style":264},[24944],{"type":30,"value":5651},{"type":20,"tag":194,"props":24946,"children":24947},{"class":196,"line":275},[24948,24953,24957,24961],{"type":20,"tag":194,"props":24949,"children":24950},{"style":264},[24951],{"type":30,"value":24952},"form ",{"type":20,"tag":194,"props":24954,"children":24955},{"style":252},[24956],{"type":30,"value":461},{"type":20,"tag":194,"props":24958,"children":24959},{"style":258},[24960],{"type":30,"value":17465},{"type":20,"tag":194,"props":24962,"children":24963},{"style":264},[24964],{"type":30,"value":24965},"(options.form),\n",{"type":20,"tag":194,"props":24967,"children":24968},{"class":196,"line":284},[24969,24974,24978,24982],{"type":20,"tag":194,"props":24970,"children":24971},{"style":258},[24972],{"type":30,"value":24973},"cleanup",{"type":20,"tag":194,"props":24975,"children":24976},{"style":252},[24977],{"type":30,"value":3298},{"type":20,"tag":194,"props":24979,"children":24980},{"style":252},[24981],{"type":30,"value":3303},{"type":20,"tag":194,"props":24983,"children":24984},{"style":264},[24985],{"type":30,"value":4121},{"type":20,"tag":194,"props":24987,"children":24988},{"class":196,"line":311},[24989,24994,24999],{"type":20,"tag":194,"props":24990,"children":24991},{"style":264},[24992],{"type":30,"value":24993},"    hiframe.",{"type":20,"tag":194,"props":24995,"children":24996},{"style":258},[24997],{"type":30,"value":24998},"remove",{"type":20,"tag":194,"props":25000,"children":25001},{"style":264},[25002],{"type":30,"value":539},{"type":20,"tag":194,"props":25004,"children":25005},{"class":196,"line":320},[25006,25011],{"type":20,"tag":194,"props":25007,"children":25008},{"style":252},[25009],{"type":30,"value":25010},"    delete",{"type":20,"tag":194,"props":25012,"children":25013},{"style":264},[25014],{"type":30,"value":25015}," frames[name];\n",{"type":20,"tag":194,"props":25017,"children":25018},{"class":196,"line":347},[25019],{"type":20,"tag":194,"props":25020,"children":25021},{"style":264},[25022],{"type":30,"value":19773},{"type":20,"tag":21,"props":25024,"children":25025},{},[25026,25028,25033],{"type":30,"value":25027},"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":20,"tag":5490,"props":25029,"children":25030},{},[25031],{"type":30,"value":25032},"Note",{"type":30,"value":25034},": 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":20,"tag":184,"props":25036,"children":25038},{"className":186,"code":25037,"language":188,"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",[25039],{"type":20,"tag":68,"props":25040,"children":25041},{"__ignoreMap":8},[25042,25097,25104,25128,25147,25154,25161],{"type":20,"tag":194,"props":25043,"children":25044},{"class":196,"line":197},[25045,25049,25053,25057,25062,25066,25070,25075,25079,25084,25088,25093],{"type":20,"tag":194,"props":25046,"children":25047},{"style":252},[25048],{"type":30,"value":21621},{"type":20,"tag":194,"props":25050,"children":25051},{"style":264},[25052],{"type":30,"value":1172},{"type":20,"tag":194,"props":25054,"children":25055},{"style":252},[25056],{"type":30,"value":1369},{"type":20,"tag":194,"props":25058,"children":25059},{"style":264},[25060],{"type":30,"value":25061},"form.",{"type":20,"tag":194,"props":25063,"children":25064},{"style":680},[25065],{"type":30,"value":17741},{"type":20,"tag":194,"props":25067,"children":25068},{"style":252},[25069],{"type":30,"value":5181},{"type":20,"tag":194,"props":25071,"children":25072},{"style":264},[25073],{"type":30,"value":25074}," form[",{"type":20,"tag":194,"props":25076,"children":25077},{"style":680},[25078],{"type":30,"value":6487},{"type":20,"tag":194,"props":25080,"children":25081},{"style":264},[25082],{"type":30,"value":25083},"].tagName ",{"type":20,"tag":194,"props":25085,"children":25086},{"style":252},[25087],{"type":30,"value":17104},{"type":20,"tag":194,"props":25089,"children":25090},{"style":506},[25091],{"type":30,"value":25092}," 'FORM'",{"type":20,"tag":194,"props":25094,"children":25095},{"style":264},[25096],{"type":30,"value":5702},{"type":20,"tag":194,"props":25098,"children":25099},{"class":196,"line":207},[25100],{"type":20,"tag":194,"props":25101,"children":25102},{"style":264},[25103],{"type":30,"value":13056},{"type":20,"tag":194,"props":25105,"children":25106},{"class":196,"line":216},[25107,25111,25115,25119,25124],{"type":20,"tag":194,"props":25108,"children":25109},{"style":264},[25110],{"type":30,"value":15454},{"type":20,"tag":194,"props":25112,"children":25113},{"style":258},[25114],{"type":30,"value":1186},{"type":20,"tag":194,"props":25116,"children":25117},{"style":264},[25118],{"type":30,"value":403},{"type":20,"tag":194,"props":25120,"children":25121},{"style":506},[25122],{"type":30,"value":25123},"\"No form element specified to submit.\"",{"type":20,"tag":194,"props":25125,"children":25126},{"style":264},[25127],{"type":30,"value":1649},{"type":20,"tag":194,"props":25129,"children":25130},{"class":196,"line":225},[25131,25135,25139,25143],{"type":20,"tag":194,"props":25132,"children":25133},{"style":252},[25134],{"type":30,"value":1379},{"type":20,"tag":194,"props":25136,"children":25137},{"style":264},[25138],{"type":30,"value":10479},{"type":20,"tag":194,"props":25140,"children":25141},{"style":258},[25142],{"type":30,"value":10027},{"type":20,"tag":194,"props":25144,"children":25145},{"style":264},[25146],{"type":30,"value":539},{"type":20,"tag":194,"props":25148,"children":25149},{"class":196,"line":234},[25150],{"type":20,"tag":194,"props":25151,"children":25152},{"style":264},[25153],{"type":30,"value":864},{"type":20,"tag":194,"props":25155,"children":25156},{"class":196,"line":243},[25157],{"type":20,"tag":194,"props":25158,"children":25159},{"emptyLinePlaceholder":546},[25160],{"type":30,"value":549},{"type":20,"tag":194,"props":25162,"children":25163},{"class":196,"line":275},[25164,25168,25172,25176,25180,25185,25190],{"type":20,"tag":194,"props":25165,"children":25166},{"style":264},[25167],{"type":30,"value":25061},{"type":20,"tag":194,"props":25169,"children":25170},{"style":258},[25171],{"type":30,"value":24331},{"type":20,"tag":194,"props":25173,"children":25174},{"style":264},[25175],{"type":30,"value":403},{"type":20,"tag":194,"props":25177,"children":25178},{"style":506},[25179],{"type":30,"value":24340},{"type":20,"tag":194,"props":25181,"children":25182},{"style":264},[25183],{"type":30,"value":25184},", name).",{"type":20,"tag":194,"props":25186,"children":25187},{"style":258},[25188],{"type":30,"value":25189},"append",{"type":20,"tag":194,"props":25191,"children":25192},{"style":264},[25193],{"type":30,"value":25194},"(hiframe);\n",{"type":20,"tag":21,"props":25196,"children":25197},{},[25198],{"type":30,"value":25199},"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":20,"tag":184,"props":25201,"children":25203},{"className":186,"code":25202,"language":188,"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",[25204],{"type":20,"tag":68,"props":25205,"children":25206},{"__ignoreMap":8},[25207,25239,25250,25257,25281,25288,25300,25345,25352,25396,25403,25411,25418,25458,25465,25481,25489,25501,25549,25560,25567],{"type":20,"tag":194,"props":25208,"children":25209},{"class":196,"line":197},[25210,25215,25219,25223,25227,25231,25235],{"type":20,"tag":194,"props":25211,"children":25212},{"style":264},[25213],{"type":30,"value":25214},"hiframe.",{"type":20,"tag":194,"props":25216,"children":25217},{"style":258},[25218],{"type":30,"value":24262},{"type":20,"tag":194,"props":25220,"children":25221},{"style":264},[25222],{"type":30,"value":403},{"type":20,"tag":194,"props":25224,"children":25225},{"style":506},[25226],{"type":30,"value":4108},{"type":20,"tag":194,"props":25228,"children":25229},{"style":264},[25230],{"type":30,"value":414},{"type":20,"tag":194,"props":25232,"children":25233},{"style":252},[25234],{"type":30,"value":393},{"type":20,"tag":194,"props":25236,"children":25237},{"style":264},[25238],{"type":30,"value":4121},{"type":20,"tag":194,"props":25240,"children":25241},{"class":196,"line":207},[25242,25246],{"type":20,"tag":194,"props":25243,"children":25244},{"style":252},[25245],{"type":30,"value":4057},{"type":20,"tag":194,"props":25247,"children":25248},{"style":264},[25249],{"type":30,"value":16181},{"type":20,"tag":194,"props":25251,"children":25252},{"class":196,"line":216},[25253],{"type":20,"tag":194,"props":25254,"children":25255},{"emptyLinePlaceholder":546},[25256],{"type":30,"value":549},{"type":20,"tag":194,"props":25258,"children":25259},{"class":196,"line":225},[25260,25264,25269,25273,25277],{"type":20,"tag":194,"props":25261,"children":25262},{"style":264},[25263],{"type":30,"value":25061},{"type":20,"tag":194,"props":25265,"children":25266},{"style":258},[25267],{"type":30,"value":25268},"removeAttr",{"type":20,"tag":194,"props":25270,"children":25271},{"style":264},[25272],{"type":30,"value":403},{"type":20,"tag":194,"props":25274,"children":25275},{"style":506},[25276],{"type":30,"value":24340},{"type":20,"tag":194,"props":25278,"children":25279},{"style":264},[25280],{"type":30,"value":1649},{"type":20,"tag":194,"props":25282,"children":25283},{"class":196,"line":234},[25284],{"type":20,"tag":194,"props":25285,"children":25286},{"emptyLinePlaceholder":546},[25287],{"type":30,"value":549},{"type":20,"tag":194,"props":25289,"children":25290},{"class":196,"line":243},[25291,25296],{"type":20,"tag":194,"props":25292,"children":25293},{"style":252},[25294],{"type":30,"value":25295},"try",{"type":20,"tag":194,"props":25297,"children":25298},{"style":264},[25299],{"type":30,"value":13056},{"type":20,"tag":194,"props":25301,"children":25302},{"class":196,"line":275},[25303,25307,25312,25316,25320,25324,25328,25333,25337,25341],{"type":20,"tag":194,"props":25304,"children":25305},{"style":252},[25306],{"type":30,"value":21621},{"type":20,"tag":194,"props":25308,"children":25309},{"style":264},[25310],{"type":30,"value":25311}," (options.dataType.",{"type":20,"tag":194,"props":25313,"children":25314},{"style":258},[25315],{"type":30,"value":17086},{"type":20,"tag":194,"props":25317,"children":25318},{"style":264},[25319],{"type":30,"value":403},{"type":20,"tag":194,"props":25321,"children":25322},{"style":506},[25323],{"type":30,"value":6378},{"type":20,"tag":194,"props":25325,"children":25326},{"style":264},[25327],{"type":30,"value":514},{"type":20,"tag":194,"props":25329,"children":25330},{"style":252},[25331],{"type":30,"value":25332},"!=",{"type":20,"tag":194,"props":25334,"children":25335},{"style":252},[25336],{"type":30,"value":17109},{"type":20,"tag":194,"props":25338,"children":25339},{"style":680},[25340],{"type":30,"value":9401},{"type":20,"tag":194,"props":25342,"children":25343},{"style":264},[25344],{"type":30,"value":5702},{"type":20,"tag":194,"props":25346,"children":25347},{"class":196,"line":284},[25348],{"type":20,"tag":194,"props":25349,"children":25350},{"style":264},[25351],{"type":30,"value":13056},{"type":20,"tag":194,"props":25353,"children":25354},{"class":196,"line":311},[25355,25360,25364,25369,25374,25378,25383,25387,25391],{"type":20,"tag":194,"props":25356,"children":25357},{"style":264},[25358],{"type":30,"value":25359},"    res ",{"type":20,"tag":194,"props":25361,"children":25362},{"style":252},[25363],{"type":30,"value":461},{"type":20,"tag":194,"props":25365,"children":25366},{"style":264},[25367],{"type":30,"value":25368}," frames[name].document.",{"type":20,"tag":194,"props":25370,"children":25371},{"style":258},[25372],{"type":30,"value":25373},"getElementsByTagName",{"type":20,"tag":194,"props":25375,"children":25376},{"style":264},[25377],{"type":30,"value":403},{"type":20,"tag":194,"props":25379,"children":25380},{"style":506},[25381],{"type":30,"value":25382},"\"pre\"",{"type":20,"tag":194,"props":25384,"children":25385},{"style":264},[25386],{"type":30,"value":6482},{"type":20,"tag":194,"props":25388,"children":25389},{"style":680},[25390],{"type":30,"value":6487},{"type":20,"tag":194,"props":25392,"children":25393},{"style":264},[25394],{"type":30,"value":25395},"].innerHTML;\n",{"type":20,"tag":194,"props":25397,"children":25398},{"class":196,"line":320},[25399],{"type":20,"tag":194,"props":25400,"children":25401},{"style":264},[25402],{"type":30,"value":864},{"type":20,"tag":194,"props":25404,"children":25405},{"class":196,"line":347},[25406],{"type":20,"tag":194,"props":25407,"children":25408},{"style":252},[25409],{"type":30,"value":25410},"else\n",{"type":20,"tag":194,"props":25412,"children":25413},{"class":196,"line":356},[25414],{"type":20,"tag":194,"props":25415,"children":25416},{"style":264},[25417],{"type":30,"value":13056},{"type":20,"tag":194,"props":25419,"children":25420},{"class":196,"line":378},[25421,25425,25429,25433,25437,25441,25446,25450,25454],{"type":20,"tag":194,"props":25422,"children":25423},{"style":264},[25424],{"type":30,"value":25359},{"type":20,"tag":194,"props":25426,"children":25427},{"style":252},[25428],{"type":30,"value":461},{"type":20,"tag":194,"props":25430,"children":25431},{"style":264},[25432],{"type":30,"value":25368},{"type":20,"tag":194,"props":25434,"children":25435},{"style":258},[25436],{"type":30,"value":25373},{"type":20,"tag":194,"props":25438,"children":25439},{"style":264},[25440],{"type":30,"value":403},{"type":20,"tag":194,"props":25442,"children":25443},{"style":506},[25444],{"type":30,"value":25445},"'body'",{"type":20,"tag":194,"props":25447,"children":25448},{"style":264},[25449],{"type":30,"value":6482},{"type":20,"tag":194,"props":25451,"children":25452},{"style":680},[25453],{"type":30,"value":6487},{"type":20,"tag":194,"props":25455,"children":25456},{"style":264},[25457],{"type":30,"value":25395},{"type":20,"tag":194,"props":25459,"children":25460},{"class":196,"line":387},[25461],{"type":20,"tag":194,"props":25462,"children":25463},{"style":264},[25464],{"type":30,"value":864},{"type":20,"tag":194,"props":25466,"children":25467},{"class":196,"line":445},[25468,25473,25477],{"type":20,"tag":194,"props":25469,"children":25470},{"style":264},[25471],{"type":30,"value":25472},"}",{"type":20,"tag":194,"props":25474,"children":25475},{"style":252},[25476],{"type":30,"value":754},{"type":20,"tag":194,"props":25478,"children":25479},{"style":264},[25480],{"type":30,"value":13125},{"type":20,"tag":194,"props":25482,"children":25483},{"class":196,"line":479},[25484],{"type":20,"tag":194,"props":25485,"children":25486},{"style":201},[25487],{"type":30,"value":25488},"    // Failed to receive anything in the body of the frame\n",{"type":20,"tag":194,"props":25490,"children":25491},{"class":196,"line":542},[25492,25497],{"type":20,"tag":194,"props":25493,"children":25494},{"style":258},[25495],{"type":30,"value":25496},"    cleanup",{"type":20,"tag":194,"props":25498,"children":25499},{"style":264},[25500],{"type":30,"value":539},{"type":20,"tag":194,"props":25502,"children":25503},{"class":196,"line":552},[25504,25509,25513,25517,25522,25526,25531,25535,25540,25544],{"type":20,"tag":194,"props":25505,"children":25506},{"style":264},[25507],{"type":30,"value":25508},"    defer.",{"type":20,"tag":194,"props":25510,"children":25511},{"style":258},[25512],{"type":30,"value":1186},{"type":20,"tag":194,"props":25514,"children":25515},{"style":264},[25516],{"type":30,"value":403},{"type":20,"tag":194,"props":25518,"children":25519},{"style":506},[25520],{"type":30,"value":25521},"\"Failed to receive response in form target \"",{"type":20,"tag":194,"props":25523,"children":25524},{"style":252},[25525],{"type":30,"value":649},{"type":20,"tag":194,"props":25527,"children":25528},{"style":264},[25529],{"type":30,"value":25530},"name",{"type":20,"tag":194,"props":25532,"children":25533},{"style":252},[25534],{"type":30,"value":649},{"type":20,"tag":194,"props":25536,"children":25537},{"style":506},[25538],{"type":30,"value":25539},"\": \"",{"type":20,"tag":194,"props":25541,"children":25542},{"style":252},[25543],{"type":30,"value":649},{"type":20,"tag":194,"props":25545,"children":25546},{"style":264},[25547],{"type":30,"value":25548},"e.message);\n",{"type":20,"tag":194,"props":25550,"children":25551},{"class":196,"line":598},[25552,25556],{"type":20,"tag":194,"props":25553,"children":25554},{"style":252},[25555],{"type":30,"value":850},{"type":20,"tag":194,"props":25557,"children":25558},{"style":264},[25559],{"type":30,"value":1384},{"type":20,"tag":194,"props":25561,"children":25562},{"class":196,"line":611},[25563],{"type":20,"tag":194,"props":25564,"children":25565},{"style":264},[25566],{"type":30,"value":864},{"type":20,"tag":194,"props":25568,"children":25569},{"class":196,"line":630},[25570,25574],{"type":20,"tag":194,"props":25571,"children":25572},{"style":258},[25573],{"type":30,"value":24973},{"type":20,"tag":194,"props":25575,"children":25576},{"style":264},[25577],{"type":30,"value":539},{"type":20,"tag":21,"props":25579,"children":25580},{},[25581],{"type":30,"value":25582},"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":20,"tag":184,"props":25584,"children":25586},{"className":186,"code":25585,"language":188,"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",[25587],{"type":20,"tag":68,"props":25588,"children":25589},{"__ignoreMap":8},[25590,25633,25640,25651,25675,25690,25718,25729,25736,25743,25792,25799,25824,25831,25846,25853,25860,25876,25883],{"type":20,"tag":194,"props":25591,"children":25592},{"class":196,"line":197},[25593,25597,25601,25605,25609,25613,25617,25621,25625,25629],{"type":20,"tag":194,"props":25594,"children":25595},{"style":252},[25596],{"type":30,"value":21621},{"type":20,"tag":194,"props":25598,"children":25599},{"style":264},[25600],{"type":30,"value":25311},{"type":20,"tag":194,"props":25602,"children":25603},{"style":258},[25604],{"type":30,"value":17086},{"type":20,"tag":194,"props":25606,"children":25607},{"style":264},[25608],{"type":30,"value":403},{"type":20,"tag":194,"props":25610,"children":25611},{"style":506},[25612],{"type":30,"value":6378},{"type":20,"tag":194,"props":25614,"children":25615},{"style":264},[25616],{"type":30,"value":514},{"type":20,"tag":194,"props":25618,"children":25619},{"style":252},[25620],{"type":30,"value":25332},{"type":20,"tag":194,"props":25622,"children":25623},{"style":252},[25624],{"type":30,"value":17109},{"type":20,"tag":194,"props":25626,"children":25627},{"style":680},[25628],{"type":30,"value":9401},{"type":20,"tag":194,"props":25630,"children":25631},{"style":264},[25632],{"type":30,"value":5702},{"type":20,"tag":194,"props":25634,"children":25635},{"class":196,"line":207},[25636],{"type":20,"tag":194,"props":25637,"children":25638},{"style":264},[25639],{"type":30,"value":13056},{"type":20,"tag":194,"props":25641,"children":25642},{"class":196,"line":216},[25643,25647],{"type":20,"tag":194,"props":25644,"children":25645},{"style":252},[25646],{"type":30,"value":25295},{"type":20,"tag":194,"props":25648,"children":25649},{"style":264},[25650],{"type":30,"value":13056},{"type":20,"tag":194,"props":25652,"children":25653},{"class":196,"line":225},[25654,25658,25662,25666,25671],{"type":20,"tag":194,"props":25655,"children":25656},{"style":264},[25657],{"type":30,"value":25359},{"type":20,"tag":194,"props":25659,"children":25660},{"style":252},[25661],{"type":30,"value":461},{"type":20,"tag":194,"props":25663,"children":25664},{"style":264},[25665],{"type":30,"value":9118},{"type":20,"tag":194,"props":25667,"children":25668},{"style":258},[25669],{"type":30,"value":25670},"parseJSON",{"type":20,"tag":194,"props":25672,"children":25673},{"style":264},[25674],{"type":30,"value":7399},{"type":20,"tag":194,"props":25676,"children":25677},{"class":196,"line":234},[25678,25682,25686],{"type":20,"tag":194,"props":25679,"children":25680},{"style":264},[25681],{"type":30,"value":25472},{"type":20,"tag":194,"props":25683,"children":25684},{"style":252},[25685],{"type":30,"value":754},{"type":20,"tag":194,"props":25687,"children":25688},{"style":264},[25689],{"type":30,"value":13125},{"type":20,"tag":194,"props":25691,"children":25692},{"class":196,"line":243},[25693,25697,25701,25705,25710,25714],{"type":20,"tag":194,"props":25694,"children":25695},{"style":264},[25696],{"type":30,"value":25508},{"type":20,"tag":194,"props":25698,"children":25699},{"style":258},[25700],{"type":30,"value":1186},{"type":20,"tag":194,"props":25702,"children":25703},{"style":264},[25704],{"type":30,"value":403},{"type":20,"tag":194,"props":25706,"children":25707},{"style":506},[25708],{"type":30,"value":25709},"\"Failed to parse response into JSON: \"",{"type":20,"tag":194,"props":25711,"children":25712},{"style":252},[25713],{"type":30,"value":649},{"type":20,"tag":194,"props":25715,"children":25716},{"style":264},[25717],{"type":30,"value":25548},{"type":20,"tag":194,"props":25719,"children":25720},{"class":196,"line":275},[25721,25725],{"type":20,"tag":194,"props":25722,"children":25723},{"style":252},[25724],{"type":30,"value":850},{"type":20,"tag":194,"props":25726,"children":25727},{"style":264},[25728],{"type":30,"value":1384},{"type":20,"tag":194,"props":25730,"children":25731},{"class":196,"line":284},[25732],{"type":20,"tag":194,"props":25733,"children":25734},{"style":264},[25735],{"type":30,"value":864},{"type":20,"tag":194,"props":25737,"children":25738},{"class":196,"line":311},[25739],{"type":20,"tag":194,"props":25740,"children":25741},{"style":264},[25742],{"type":30,"value":864},{"type":20,"tag":194,"props":25744,"children":25745},{"class":196,"line":320},[25746,25750,25755,25759,25763,25767,25772,25776,25780,25784,25788],{"type":20,"tag":194,"props":25747,"children":25748},{"style":252},[25749],{"type":30,"value":23622},{"type":20,"tag":194,"props":25751,"children":25752},{"style":252},[25753],{"type":30,"value":25754}," if",{"type":20,"tag":194,"props":25756,"children":25757},{"style":264},[25758],{"type":30,"value":25311},{"type":20,"tag":194,"props":25760,"children":25761},{"style":258},[25762],{"type":30,"value":17086},{"type":20,"tag":194,"props":25764,"children":25765},{"style":264},[25766],{"type":30,"value":403},{"type":20,"tag":194,"props":25768,"children":25769},{"style":506},[25770],{"type":30,"value":25771},"'html'",{"type":20,"tag":194,"props":25773,"children":25774},{"style":264},[25775],{"type":30,"value":514},{"type":20,"tag":194,"props":25777,"children":25778},{"style":252},[25779],{"type":30,"value":25332},{"type":20,"tag":194,"props":25781,"children":25782},{"style":252},[25783],{"type":30,"value":17109},{"type":20,"tag":194,"props":25785,"children":25786},{"style":680},[25787],{"type":30,"value":9401},{"type":20,"tag":194,"props":25789,"children":25790},{"style":264},[25791],{"type":30,"value":5702},{"type":20,"tag":194,"props":25793,"children":25794},{"class":196,"line":347},[25795],{"type":20,"tag":194,"props":25796,"children":25797},{"style":264},[25798],{"type":30,"value":13056},{"type":20,"tag":194,"props":25800,"children":25801},{"class":196,"line":356},[25802,25807,25811,25815,25820],{"type":20,"tag":194,"props":25803,"children":25804},{"style":264},[25805],{"type":30,"value":25806},"res ",{"type":20,"tag":194,"props":25808,"children":25809},{"style":252},[25810],{"type":30,"value":461},{"type":20,"tag":194,"props":25812,"children":25813},{"style":264},[25814],{"type":30,"value":9118},{"type":20,"tag":194,"props":25816,"children":25817},{"style":258},[25818],{"type":30,"value":25819},"parseHTML",{"type":20,"tag":194,"props":25821,"children":25822},{"style":264},[25823],{"type":30,"value":7399},{"type":20,"tag":194,"props":25825,"children":25826},{"class":196,"line":378},[25827],{"type":20,"tag":194,"props":25828,"children":25829},{"style":264},[25830],{"type":30,"value":864},{"type":20,"tag":194,"props":25832,"children":25833},{"class":196,"line":387},[25834,25838,25842],{"type":20,"tag":194,"props":25835,"children":25836},{"style":264},[25837],{"type":30,"value":15454},{"type":20,"tag":194,"props":25839,"children":25840},{"style":258},[25841],{"type":30,"value":1177},{"type":20,"tag":194,"props":25843,"children":25844},{"style":264},[25845],{"type":30,"value":7399},{"type":20,"tag":194,"props":25847,"children":25848},{"class":196,"line":445},[25849],{"type":20,"tag":194,"props":25850,"children":25851},{"style":264},[25852],{"type":30,"value":4204},{"type":20,"tag":194,"props":25854,"children":25855},{"class":196,"line":479},[25856],{"type":20,"tag":194,"props":25857,"children":25858},{"emptyLinePlaceholder":546},[25859],{"type":30,"value":549},{"type":20,"tag":194,"props":25861,"children":25862},{"class":196,"line":542},[25863,25867,25872],{"type":20,"tag":194,"props":25864,"children":25865},{"style":264},[25866],{"type":30,"value":25061},{"type":20,"tag":194,"props":25868,"children":25869},{"style":258},[25870],{"type":30,"value":25871},"submit",{"type":20,"tag":194,"props":25873,"children":25874},{"style":264},[25875],{"type":30,"value":539},{"type":20,"tag":194,"props":25877,"children":25878},{"class":196,"line":552},[25879],{"type":20,"tag":194,"props":25880,"children":25881},{"emptyLinePlaceholder":546},[25882],{"type":30,"value":549},{"type":20,"tag":194,"props":25884,"children":25885},{"class":196,"line":598},[25886,25890,25894,25898],{"type":20,"tag":194,"props":25887,"children":25888},{"style":252},[25889],{"type":30,"value":1379},{"type":20,"tag":194,"props":25891,"children":25892},{"style":264},[25893],{"type":30,"value":10479},{"type":20,"tag":194,"props":25895,"children":25896},{"style":258},[25897],{"type":30,"value":10027},{"type":20,"tag":194,"props":25899,"children":25900},{"style":264},[25901],{"type":30,"value":539},{"type":20,"tag":21,"props":25903,"children":25904},{},[25905],{"type":30,"value":25906},"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":20,"tag":5510,"props":25908,"children":25910},{"id":25909},"aside-other-uses",[25911],{"type":30,"value":25912},"Aside: Other Uses",{"type":20,"tag":21,"props":25914,"children":25915},{},[25916],{"type":30,"value":25917},"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":20,"tag":5510,"props":25919,"children":25921},{"id":25920},"the-gist",[25922],{"type":30,"value":25923},"The Gist",{"type":20,"tag":21,"props":25925,"children":25926},{},[25927],{"type":30,"value":25928},"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":20,"tag":184,"props":25930,"children":25932},{"className":186,"code":25931,"language":188,"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",[25933],{"type":20,"tag":68,"props":25934,"children":25935},{"__ignoreMap":8},[25936,25943,25951,25959,25967,25975,25983,25990,26013,26044,26077,26101,26113,26135,26205,26268,26285,26311,26331,26347,26359,26372,26429,26452,26471,26478,26485,26523,26530,26538,26570,26581,26588,26612,26619,26630,26674,26687,26727,26734,26742,26749,26788,26795,26811,26819,26831,26874,26885,26892,26899,26910,26917,26960,26967,26979,27002,27018,27045,27057,27064,27071,27119,27126,27150,27157,27164,27185,27192,27199,27214,27221,27240,27247,27254,27262,27270,27278,27285,27316,27336,27356,27363],{"type":20,"tag":194,"props":25937,"children":25938},{"class":196,"line":197},[25939],{"type":20,"tag":194,"props":25940,"children":25941},{"style":201},[25942],{"type":30,"value":1264},{"type":20,"tag":194,"props":25944,"children":25945},{"class":196,"line":207},[25946],{"type":20,"tag":194,"props":25947,"children":25948},{"style":201},[25949],{"type":30,"value":25950}," * jQuery plugin for transparent submission of a form using an $.ajax-like interface.\n",{"type":20,"tag":194,"props":25952,"children":25953},{"class":196,"line":216},[25954],{"type":20,"tag":194,"props":25955,"children":25956},{"style":201},[25957],{"type":30,"value":25958}," * Usage Examples:\n",{"type":20,"tag":194,"props":25960,"children":25961},{"class":196,"line":225},[25962],{"type":20,"tag":194,"props":25963,"children":25964},{"style":201},[25965],{"type":30,"value":25966}," * $.transparentSubmit({dataType:'json', form:$('#myForm')})\n",{"type":20,"tag":194,"props":25968,"children":25969},{"class":196,"line":234},[25970],{"type":20,"tag":194,"props":25971,"children":25972},{"style":201},[25973],{"type":30,"value":25974}," * $('#myForm').transparentSubmit({dataType:'html'})\n",{"type":20,"tag":194,"props":25976,"children":25977},{"class":196,"line":243},[25978],{"type":20,"tag":194,"props":25979,"children":25980},{"style":201},[25981],{"type":30,"value":25982}," * Supports Deferred (.done, .fail, .when, etc.)\n",{"type":20,"tag":194,"props":25984,"children":25985},{"class":196,"line":275},[25986],{"type":20,"tag":194,"props":25987,"children":25988},{"style":201},[25989],{"type":30,"value":1312},{"type":20,"tag":194,"props":25991,"children":25992},{"class":196,"line":284},[25993,25997,26001,26005,26009],{"type":20,"tag":194,"props":25994,"children":25995},{"style":264},[25996],{"type":30,"value":403},{"type":20,"tag":194,"props":25998,"children":25999},{"style":252},[26000],{"type":30,"value":393},{"type":20,"tag":194,"props":26002,"children":26003},{"style":264},[26004],{"type":30,"value":403},{"type":20,"tag":194,"props":26006,"children":26007},{"style":406},[26008],{"type":30,"value":6468},{"type":20,"tag":194,"props":26010,"children":26011},{"style":264},[26012],{"type":30,"value":4253},{"type":20,"tag":194,"props":26014,"children":26015},{"class":196,"line":311},[26016,26020,26024,26028,26032,26036,26040],{"type":20,"tag":194,"props":26017,"children":26018},{"style":264},[26019],{"type":30,"value":13352},{"type":20,"tag":194,"props":26021,"children":26022},{"style":258},[26023],{"type":30,"value":24420},{"type":20,"tag":194,"props":26025,"children":26026},{"style":252},[26027],{"type":30,"value":3298},{"type":20,"tag":194,"props":26029,"children":26030},{"style":252},[26031],{"type":30,"value":3303},{"type":20,"tag":194,"props":26033,"children":26034},{"style":264},[26035],{"type":30,"value":403},{"type":20,"tag":194,"props":26037,"children":26038},{"style":406},[26039],{"type":30,"value":12047},{"type":20,"tag":194,"props":26041,"children":26042},{"style":264},[26043],{"type":30,"value":4253},{"type":20,"tag":194,"props":26045,"children":26046},{"class":196,"line":320},[26047,26051,26055,26059,26063,26067,26072],{"type":20,"tag":194,"props":26048,"children":26049},{"style":252},[26050],{"type":30,"value":1491},{"type":20,"tag":194,"props":26052,"children":26053},{"style":264},[26054],{"type":30,"value":10298},{"type":20,"tag":194,"props":26056,"children":26057},{"style":252},[26058],{"type":30,"value":461},{"type":20,"tag":194,"props":26060,"children":26061},{"style":264},[26062],{"type":30,"value":9118},{"type":20,"tag":194,"props":26064,"children":26065},{"style":258},[26066],{"type":30,"value":9123},{"type":20,"tag":194,"props":26068,"children":26069},{"style":264},[26070],{"type":30,"value":26071},"(), ",{"type":20,"tag":194,"props":26073,"children":26074},{"style":201},[26075],{"type":30,"value":26076},"// Deferred object whose promise we will hook into when adding .done, etc to calls\n",{"type":20,"tag":194,"props":26078,"children":26079},{"class":196,"line":347},[26080,26085,26089,26093,26097],{"type":20,"tag":194,"props":26081,"children":26082},{"style":264},[26083],{"type":30,"value":26084},"            options ",{"type":20,"tag":194,"props":26086,"children":26087},{"style":252},[26088],{"type":30,"value":461},{"type":20,"tag":194,"props":26090,"children":26091},{"style":264},[26092],{"type":30,"value":9118},{"type":20,"tag":194,"props":26094,"children":26095},{"style":258},[26096],{"type":30,"value":24813},{"type":20,"tag":194,"props":26098,"children":26099},{"style":264},[26100],{"type":30,"value":4437},{"type":20,"tag":194,"props":26102,"children":26103},{"class":196,"line":356},[26104,26109],{"type":20,"tag":194,"props":26105,"children":26106},{"style":264},[26107],{"type":30,"value":26108},"                dataType:",{"type":20,"tag":194,"props":26110,"children":26111},{"style":506},[26112],{"type":30,"value":4483},{"type":20,"tag":194,"props":26114,"children":26115},{"class":196,"line":378},[26116,26121,26125,26130],{"type":20,"tag":194,"props":26117,"children":26118},{"style":264},[26119],{"type":30,"value":26120},"            }, (options ",{"type":20,"tag":194,"props":26122,"children":26123},{"style":252},[26124],{"type":30,"value":519},{"type":20,"tag":194,"props":26126,"children":26127},{"style":264},[26128],{"type":30,"value":26129}," {})), ",{"type":20,"tag":194,"props":26131,"children":26132},{"style":201},[26133],{"type":30,"value":26134},"// coerce options into being an object, extend defaults\n",{"type":20,"tag":194,"props":26136,"children":26137},{"class":196,"line":387},[26138,26143,26147,26151,26155,26159,26163,26167,26171,26175,26179,26183,26187,26191,26195,26200],{"type":20,"tag":194,"props":26139,"children":26140},{"style":264},[26141],{"type":30,"value":26142},"            name ",{"type":20,"tag":194,"props":26144,"children":26145},{"style":252},[26146],{"type":30,"value":461},{"type":20,"tag":194,"props":26148,"children":26149},{"style":506},[26150],{"type":30,"value":24862},{"type":20,"tag":194,"props":26152,"children":26153},{"style":252},[26154],{"type":30,"value":649},{"type":20,"tag":194,"props":26156,"children":26157},{"style":264},[26158],{"type":30,"value":24871},{"type":20,"tag":194,"props":26160,"children":26161},{"style":258},[26162],{"type":30,"value":24876},{"type":20,"tag":194,"props":26164,"children":26165},{"style":264},[26166],{"type":30,"value":567},{"type":20,"tag":194,"props":26168,"children":26169},{"style":258},[26170],{"type":30,"value":24885},{"type":20,"tag":194,"props":26172,"children":26173},{"style":264},[26174],{"type":30,"value":403},{"type":20,"tag":194,"props":26176,"children":26177},{"style":680},[26178],{"type":30,"value":24894},{"type":20,"tag":194,"props":26180,"children":26181},{"style":264},[26182],{"type":30,"value":529},{"type":20,"tag":194,"props":26184,"children":26185},{"style":258},[26186],{"type":30,"value":24903},{"type":20,"tag":194,"props":26188,"children":26189},{"style":264},[26190],{"type":30,"value":403},{"type":20,"tag":194,"props":26192,"children":26193},{"style":680},[26194],{"type":30,"value":24912},{"type":20,"tag":194,"props":26196,"children":26197},{"style":264},[26198],{"type":30,"value":26199},"), ",{"type":20,"tag":194,"props":26201,"children":26202},{"style":201},[26203],{"type":30,"value":26204},"// assign a psuedo-random name to the frame\n",{"type":20,"tag":194,"props":26206,"children":26207},{"class":196,"line":445},[26208,26213,26217,26221,26225,26230,26234,26238,26242,26247,26251,26255,26259,26264],{"type":20,"tag":194,"props":26209,"children":26210},{"style":264},[26211],{"type":30,"value":26212},"            hiframe ",{"type":20,"tag":194,"props":26214,"children":26215},{"style":252},[26216],{"type":30,"value":461},{"type":20,"tag":194,"props":26218,"children":26219},{"style":258},[26220],{"type":30,"value":17465},{"type":20,"tag":194,"props":26222,"children":26223},{"style":264},[26224],{"type":30,"value":403},{"type":20,"tag":194,"props":26226,"children":26227},{"style":506},[26228],{"type":30,"value":26229},"'\u003Ciframe id=\"'",{"type":20,"tag":194,"props":26231,"children":26232},{"style":252},[26233],{"type":30,"value":649},{"type":20,"tag":194,"props":26235,"children":26236},{"style":264},[26237],{"type":30,"value":25530},{"type":20,"tag":194,"props":26239,"children":26240},{"style":252},[26241],{"type":30,"value":649},{"type":20,"tag":194,"props":26243,"children":26244},{"style":506},[26245],{"type":30,"value":26246},"'\" name=\"'",{"type":20,"tag":194,"props":26248,"children":26249},{"style":252},[26250],{"type":30,"value":649},{"type":20,"tag":194,"props":26252,"children":26253},{"style":264},[26254],{"type":30,"value":25530},{"type":20,"tag":194,"props":26256,"children":26257},{"style":252},[26258],{"type":30,"value":649},{"type":20,"tag":194,"props":26260,"children":26261},{"style":506},[26262],{"type":30,"value":26263},"'\" src=\"about:blank\" '",{"type":20,"tag":194,"props":26265,"children":26266},{"style":252},[26267],{"type":30,"value":1988},{"type":20,"tag":194,"props":26269,"children":26270},{"class":196,"line":479},[26271,26276,26280],{"type":20,"tag":194,"props":26272,"children":26273},{"style":506},[26274],{"type":30,"value":26275},"                'style=\"width:0;height:0;border:0px solid #fff;\">\u003C/iframe>'",{"type":20,"tag":194,"props":26277,"children":26278},{"style":264},[26279],{"type":30,"value":26199},{"type":20,"tag":194,"props":26281,"children":26282},{"style":201},[26283],{"type":30,"value":26284},"// create invisible iframe - NOT display:none\n",{"type":20,"tag":194,"props":26286,"children":26287},{"class":196,"line":542},[26288,26293,26297,26301,26306],{"type":20,"tag":194,"props":26289,"children":26290},{"style":264},[26291],{"type":30,"value":26292},"            form ",{"type":20,"tag":194,"props":26294,"children":26295},{"style":252},[26296],{"type":30,"value":461},{"type":20,"tag":194,"props":26298,"children":26299},{"style":258},[26300],{"type":30,"value":17465},{"type":20,"tag":194,"props":26302,"children":26303},{"style":264},[26304],{"type":30,"value":26305},"(options.form), ",{"type":20,"tag":194,"props":26307,"children":26308},{"style":201},[26309],{"type":30,"value":26310},"// get form, make sure its a jquery object\n",{"type":20,"tag":194,"props":26312,"children":26313},{"class":196,"line":552},[26314,26319,26323,26327],{"type":20,"tag":194,"props":26315,"children":26316},{"style":258},[26317],{"type":30,"value":26318},"            cleanup",{"type":20,"tag":194,"props":26320,"children":26321},{"style":252},[26322],{"type":30,"value":3298},{"type":20,"tag":194,"props":26324,"children":26325},{"style":252},[26326],{"type":30,"value":3303},{"type":20,"tag":194,"props":26328,"children":26329},{"style":264},[26330],{"type":30,"value":4121},{"type":20,"tag":194,"props":26332,"children":26333},{"class":196,"line":598},[26334,26339,26343],{"type":20,"tag":194,"props":26335,"children":26336},{"style":264},[26337],{"type":30,"value":26338},"                hiframe.",{"type":20,"tag":194,"props":26340,"children":26341},{"style":258},[26342],{"type":30,"value":24998},{"type":20,"tag":194,"props":26344,"children":26345},{"style":264},[26346],{"type":30,"value":539},{"type":20,"tag":194,"props":26348,"children":26349},{"class":196,"line":611},[26350,26355],{"type":20,"tag":194,"props":26351,"children":26352},{"style":252},[26353],{"type":30,"value":26354},"                delete",{"type":20,"tag":194,"props":26356,"children":26357},{"style":264},[26358],{"type":30,"value":25015},{"type":20,"tag":194,"props":26360,"children":26361},{"class":196,"line":630},[26362,26367],{"type":20,"tag":194,"props":26363,"children":26364},{"style":264},[26365],{"type":30,"value":26366},"            }; ",{"type":20,"tag":194,"props":26368,"children":26369},{"style":201},[26370],{"type":30,"value":26371},"// clean iframe away when we're finished with it\n",{"type":20,"tag":194,"props":26373,"children":26374},{"class":196,"line":713},[26375,26379,26383,26387,26391,26395,26399,26403,26407,26411,26415,26419,26424],{"type":20,"tag":194,"props":26376,"children":26377},{"style":252},[26378],{"type":30,"value":1782},{"type":20,"tag":194,"props":26380,"children":26381},{"style":264},[26382],{"type":30,"value":1172},{"type":20,"tag":194,"props":26384,"children":26385},{"style":252},[26386],{"type":30,"value":1369},{"type":20,"tag":194,"props":26388,"children":26389},{"style":264},[26390],{"type":30,"value":25061},{"type":20,"tag":194,"props":26392,"children":26393},{"style":680},[26394],{"type":30,"value":17741},{"type":20,"tag":194,"props":26396,"children":26397},{"style":252},[26398],{"type":30,"value":5181},{"type":20,"tag":194,"props":26400,"children":26401},{"style":264},[26402],{"type":30,"value":25074},{"type":20,"tag":194,"props":26404,"children":26405},{"style":680},[26406],{"type":30,"value":6487},{"type":20,"tag":194,"props":26408,"children":26409},{"style":264},[26410],{"type":30,"value":25083},{"type":20,"tag":194,"props":26412,"children":26413},{"style":252},[26414],{"type":30,"value":17104},{"type":20,"tag":194,"props":26416,"children":26417},{"style":506},[26418],{"type":30,"value":25092},{"type":20,"tag":194,"props":26420,"children":26421},{"style":264},[26422],{"type":30,"value":26423},"){ ",{"type":20,"tag":194,"props":26425,"children":26426},{"style":201},[26427],{"type":30,"value":26428},"// if we don't have a form to submit, reject (call .fail)\n",{"type":20,"tag":194,"props":26430,"children":26431},{"class":196,"line":743},[26432,26436,26440,26444,26448],{"type":20,"tag":194,"props":26433,"children":26434},{"style":264},[26435],{"type":30,"value":13144},{"type":20,"tag":194,"props":26437,"children":26438},{"style":258},[26439],{"type":30,"value":1186},{"type":20,"tag":194,"props":26441,"children":26442},{"style":264},[26443],{"type":30,"value":403},{"type":20,"tag":194,"props":26445,"children":26446},{"style":506},[26447],{"type":30,"value":25123},{"type":20,"tag":194,"props":26449,"children":26450},{"style":264},[26451],{"type":30,"value":1649},{"type":20,"tag":194,"props":26453,"children":26454},{"class":196,"line":762},[26455,26459,26463,26467],{"type":20,"tag":194,"props":26456,"children":26457},{"style":252},[26458],{"type":30,"value":1943},{"type":20,"tag":194,"props":26460,"children":26461},{"style":264},[26462],{"type":30,"value":10479},{"type":20,"tag":194,"props":26464,"children":26465},{"style":258},[26466],{"type":30,"value":10027},{"type":20,"tag":194,"props":26468,"children":26469},{"style":264},[26470],{"type":30,"value":539},{"type":20,"tag":194,"props":26472,"children":26473},{"class":196,"line":771},[26474],{"type":20,"tag":194,"props":26475,"children":26476},{"style":264},[26477],{"type":30,"value":824},{"type":20,"tag":194,"props":26479,"children":26480},{"class":196,"line":785},[26481],{"type":20,"tag":194,"props":26482,"children":26483},{"emptyLinePlaceholder":546},[26484],{"type":30,"value":549},{"type":20,"tag":194,"props":26486,"children":26487},{"class":196,"line":818},[26488,26493,26497,26501,26505,26509,26513,26518],{"type":20,"tag":194,"props":26489,"children":26490},{"style":264},[26491],{"type":30,"value":26492},"        form.",{"type":20,"tag":194,"props":26494,"children":26495},{"style":258},[26496],{"type":30,"value":24331},{"type":20,"tag":194,"props":26498,"children":26499},{"style":264},[26500],{"type":30,"value":403},{"type":20,"tag":194,"props":26502,"children":26503},{"style":506},[26504],{"type":30,"value":24340},{"type":20,"tag":194,"props":26506,"children":26507},{"style":264},[26508],{"type":30,"value":25184},{"type":20,"tag":194,"props":26510,"children":26511},{"style":258},[26512],{"type":30,"value":25189},{"type":20,"tag":194,"props":26514,"children":26515},{"style":264},[26516],{"type":30,"value":26517},"(hiframe); ",{"type":20,"tag":194,"props":26519,"children":26520},{"style":201},[26521],{"type":30,"value":26522},"// set target of form to iframe, and append iframe to the form\n",{"type":20,"tag":194,"props":26524,"children":26525},{"class":196,"line":827},[26526],{"type":20,"tag":194,"props":26527,"children":26528},{"emptyLinePlaceholder":546},[26529],{"type":30,"value":549},{"type":20,"tag":194,"props":26531,"children":26532},{"class":196,"line":836},[26533],{"type":20,"tag":194,"props":26534,"children":26535},{"style":201},[26536],{"type":30,"value":26537},"        // On load event, grab and parse the contents of the iframe\n",{"type":20,"tag":194,"props":26539,"children":26540},{"class":196,"line":844},[26541,26546,26550,26554,26558,26562,26566],{"type":20,"tag":194,"props":26542,"children":26543},{"style":264},[26544],{"type":30,"value":26545},"        hiframe.",{"type":20,"tag":194,"props":26547,"children":26548},{"style":258},[26549],{"type":30,"value":24262},{"type":20,"tag":194,"props":26551,"children":26552},{"style":264},[26553],{"type":30,"value":403},{"type":20,"tag":194,"props":26555,"children":26556},{"style":506},[26557],{"type":30,"value":4108},{"type":20,"tag":194,"props":26559,"children":26560},{"style":264},[26561],{"type":30,"value":414},{"type":20,"tag":194,"props":26563,"children":26564},{"style":252},[26565],{"type":30,"value":393},{"type":20,"tag":194,"props":26567,"children":26568},{"style":264},[26569],{"type":30,"value":4121},{"type":20,"tag":194,"props":26571,"children":26572},{"class":196,"line":858},[26573,26577],{"type":20,"tag":194,"props":26574,"children":26575},{"style":252},[26576],{"type":30,"value":7360},{"type":20,"tag":194,"props":26578,"children":26579},{"style":264},[26580],{"type":30,"value":16181},{"type":20,"tag":194,"props":26582,"children":26583},{"class":196,"line":1726},[26584],{"type":20,"tag":194,"props":26585,"children":26586},{"emptyLinePlaceholder":546},[26587],{"type":30,"value":549},{"type":20,"tag":194,"props":26589,"children":26590},{"class":196,"line":1743},[26591,26596,26600,26604,26608],{"type":20,"tag":194,"props":26592,"children":26593},{"style":264},[26594],{"type":30,"value":26595},"            form.",{"type":20,"tag":194,"props":26597,"children":26598},{"style":258},[26599],{"type":30,"value":25268},{"type":20,"tag":194,"props":26601,"children":26602},{"style":264},[26603],{"type":30,"value":403},{"type":20,"tag":194,"props":26605,"children":26606},{"style":506},[26607],{"type":30,"value":24340},{"type":20,"tag":194,"props":26609,"children":26610},{"style":264},[26611],{"type":30,"value":1649},{"type":20,"tag":194,"props":26613,"children":26614},{"class":196,"line":1751},[26615],{"type":20,"tag":194,"props":26616,"children":26617},{"emptyLinePlaceholder":546},[26618],{"type":30,"value":549},{"type":20,"tag":194,"props":26620,"children":26621},{"class":196,"line":1776},[26622,26626],{"type":20,"tag":194,"props":26623,"children":26624},{"style":252},[26625],{"type":30,"value":2573},{"type":20,"tag":194,"props":26627,"children":26628},{"style":264},[26629],{"type":30,"value":13056},{"type":20,"tag":194,"props":26631,"children":26632},{"class":196,"line":1811},[26633,26638,26642,26646,26650,26654,26658,26662,26666,26670],{"type":20,"tag":194,"props":26634,"children":26635},{"style":252},[26636],{"type":30,"value":26637},"                if",{"type":20,"tag":194,"props":26639,"children":26640},{"style":264},[26641],{"type":30,"value":25311},{"type":20,"tag":194,"props":26643,"children":26644},{"style":258},[26645],{"type":30,"value":17086},{"type":20,"tag":194,"props":26647,"children":26648},{"style":264},[26649],{"type":30,"value":403},{"type":20,"tag":194,"props":26651,"children":26652},{"style":506},[26653],{"type":30,"value":6378},{"type":20,"tag":194,"props":26655,"children":26656},{"style":264},[26657],{"type":30,"value":514},{"type":20,"tag":194,"props":26659,"children":26660},{"style":252},[26661],{"type":30,"value":25332},{"type":20,"tag":194,"props":26663,"children":26664},{"style":252},[26665],{"type":30,"value":17109},{"type":20,"tag":194,"props":26667,"children":26668},{"style":680},[26669],{"type":30,"value":9401},{"type":20,"tag":194,"props":26671,"children":26672},{"style":264},[26673],{"type":30,"value":5702},{"type":20,"tag":194,"props":26675,"children":26676},{"class":196,"line":1847},[26677,26682],{"type":20,"tag":194,"props":26678,"children":26679},{"style":264},[26680],{"type":30,"value":26681},"                { ",{"type":20,"tag":194,"props":26683,"children":26684},{"style":201},[26685],{"type":30,"value":26686},"// browsers will wrap a json return with \u003Cpre>\u003C/pre>\n",{"type":20,"tag":194,"props":26688,"children":26689},{"class":196,"line":1901},[26690,26695,26699,26703,26707,26711,26715,26719,26723],{"type":20,"tag":194,"props":26691,"children":26692},{"style":264},[26693],{"type":30,"value":26694},"                    res ",{"type":20,"tag":194,"props":26696,"children":26697},{"style":252},[26698],{"type":30,"value":461},{"type":20,"tag":194,"props":26700,"children":26701},{"style":264},[26702],{"type":30,"value":25368},{"type":20,"tag":194,"props":26704,"children":26705},{"style":258},[26706],{"type":30,"value":25373},{"type":20,"tag":194,"props":26708,"children":26709},{"style":264},[26710],{"type":30,"value":403},{"type":20,"tag":194,"props":26712,"children":26713},{"style":506},[26714],{"type":30,"value":25382},{"type":20,"tag":194,"props":26716,"children":26717},{"style":264},[26718],{"type":30,"value":6482},{"type":20,"tag":194,"props":26720,"children":26721},{"style":680},[26722],{"type":30,"value":6487},{"type":20,"tag":194,"props":26724,"children":26725},{"style":264},[26726],{"type":30,"value":25395},{"type":20,"tag":194,"props":26728,"children":26729},{"class":196,"line":1937},[26730],{"type":20,"tag":194,"props":26731,"children":26732},{"style":264},[26733],{"type":30,"value":3048},{"type":20,"tag":194,"props":26735,"children":26736},{"class":196,"line":1951},[26737],{"type":20,"tag":194,"props":26738,"children":26739},{"style":252},[26740],{"type":30,"value":26741},"                else\n",{"type":20,"tag":194,"props":26743,"children":26744},{"class":196,"line":1959},[26745],{"type":20,"tag":194,"props":26746,"children":26747},{"style":264},[26748],{"type":30,"value":19589},{"type":20,"tag":194,"props":26750,"children":26751},{"class":196,"line":1991},[26752,26756,26760,26764,26768,26772,26776,26780,26784],{"type":20,"tag":194,"props":26753,"children":26754},{"style":264},[26755],{"type":30,"value":26694},{"type":20,"tag":194,"props":26757,"children":26758},{"style":252},[26759],{"type":30,"value":461},{"type":20,"tag":194,"props":26761,"children":26762},{"style":264},[26763],{"type":30,"value":25368},{"type":20,"tag":194,"props":26765,"children":26766},{"style":258},[26767],{"type":30,"value":25373},{"type":20,"tag":194,"props":26769,"children":26770},{"style":264},[26771],{"type":30,"value":403},{"type":20,"tag":194,"props":26773,"children":26774},{"style":506},[26775],{"type":30,"value":25445},{"type":20,"tag":194,"props":26777,"children":26778},{"style":264},[26779],{"type":30,"value":6482},{"type":20,"tag":194,"props":26781,"children":26782},{"style":680},[26783],{"type":30,"value":6487},{"type":20,"tag":194,"props":26785,"children":26786},{"style":264},[26787],{"type":30,"value":25395},{"type":20,"tag":194,"props":26789,"children":26790},{"class":196,"line":2004},[26791],{"type":20,"tag":194,"props":26792,"children":26793},{"style":264},[26794],{"type":30,"value":3048},{"type":20,"tag":194,"props":26796,"children":26797},{"class":196,"line":2012},[26798,26803,26807],{"type":20,"tag":194,"props":26799,"children":26800},{"style":264},[26801],{"type":30,"value":26802},"            }",{"type":20,"tag":194,"props":26804,"children":26805},{"style":252},[26806],{"type":30,"value":754},{"type":20,"tag":194,"props":26808,"children":26809},{"style":264},[26810],{"type":30,"value":13125},{"type":20,"tag":194,"props":26812,"children":26813},{"class":196,"line":2020},[26814],{"type":20,"tag":194,"props":26815,"children":26816},{"style":201},[26817],{"type":30,"value":26818},"                // Failed to receive anything in the body of the frame\n",{"type":20,"tag":194,"props":26820,"children":26821},{"class":196,"line":2028},[26822,26827],{"type":20,"tag":194,"props":26823,"children":26824},{"style":258},[26825],{"type":30,"value":26826},"                cleanup",{"type":20,"tag":194,"props":26828,"children":26829},{"style":264},[26830],{"type":30,"value":539},{"type":20,"tag":194,"props":26832,"children":26833},{"class":196,"line":2037},[26834,26838,26842,26846,26850,26854,26858,26862,26866,26870],{"type":20,"tag":194,"props":26835,"children":26836},{"style":264},[26837],{"type":30,"value":10682},{"type":20,"tag":194,"props":26839,"children":26840},{"style":258},[26841],{"type":30,"value":1186},{"type":20,"tag":194,"props":26843,"children":26844},{"style":264},[26845],{"type":30,"value":403},{"type":20,"tag":194,"props":26847,"children":26848},{"style":506},[26849],{"type":30,"value":25521},{"type":20,"tag":194,"props":26851,"children":26852},{"style":252},[26853],{"type":30,"value":649},{"type":20,"tag":194,"props":26855,"children":26856},{"style":264},[26857],{"type":30,"value":25530},{"type":20,"tag":194,"props":26859,"children":26860},{"style":252},[26861],{"type":30,"value":649},{"type":20,"tag":194,"props":26863,"children":26864},{"style":506},[26865],{"type":30,"value":25539},{"type":20,"tag":194,"props":26867,"children":26868},{"style":252},[26869],{"type":30,"value":649},{"type":20,"tag":194,"props":26871,"children":26872},{"style":264},[26873],{"type":30,"value":25548},{"type":20,"tag":194,"props":26875,"children":26876},{"class":196,"line":2045},[26877,26881],{"type":20,"tag":194,"props":26878,"children":26879},{"style":252},[26880],{"type":30,"value":10474},{"type":20,"tag":194,"props":26882,"children":26883},{"style":264},[26884],{"type":30,"value":1384},{"type":20,"tag":194,"props":26886,"children":26887},{"class":196,"line":2066},[26888],{"type":20,"tag":194,"props":26889,"children":26890},{"style":264},[26891],{"type":30,"value":1121},{"type":20,"tag":194,"props":26893,"children":26894},{"class":196,"line":2087},[26895],{"type":20,"tag":194,"props":26896,"children":26897},{"emptyLinePlaceholder":546},[26898],{"type":30,"value":549},{"type":20,"tag":194,"props":26900,"children":26901},{"class":196,"line":2095},[26902,26906],{"type":20,"tag":194,"props":26903,"children":26904},{"style":258},[26905],{"type":30,"value":26318},{"type":20,"tag":194,"props":26907,"children":26908},{"style":264},[26909],{"type":30,"value":539},{"type":20,"tag":194,"props":26911,"children":26912},{"class":196,"line":2128},[26913],{"type":20,"tag":194,"props":26914,"children":26915},{"emptyLinePlaceholder":546},[26916],{"type":30,"value":549},{"type":20,"tag":194,"props":26918,"children":26919},{"class":196,"line":2147},[26920,26924,26928,26932,26936,26940,26944,26948,26952,26956],{"type":20,"tag":194,"props":26921,"children":26922},{"style":252},[26923],{"type":30,"value":13826},{"type":20,"tag":194,"props":26925,"children":26926},{"style":264},[26927],{"type":30,"value":25311},{"type":20,"tag":194,"props":26929,"children":26930},{"style":258},[26931],{"type":30,"value":17086},{"type":20,"tag":194,"props":26933,"children":26934},{"style":264},[26935],{"type":30,"value":403},{"type":20,"tag":194,"props":26937,"children":26938},{"style":506},[26939],{"type":30,"value":6378},{"type":20,"tag":194,"props":26941,"children":26942},{"style":264},[26943],{"type":30,"value":514},{"type":20,"tag":194,"props":26945,"children":26946},{"style":252},[26947],{"type":30,"value":25332},{"type":20,"tag":194,"props":26949,"children":26950},{"style":252},[26951],{"type":30,"value":17109},{"type":20,"tag":194,"props":26953,"children":26954},{"style":680},[26955],{"type":30,"value":9401},{"type":20,"tag":194,"props":26957,"children":26958},{"style":264},[26959],{"type":30,"value":5702},{"type":20,"tag":194,"props":26961,"children":26962},{"class":196,"line":2175},[26963],{"type":20,"tag":194,"props":26964,"children":26965},{"style":264},[26966],{"type":30,"value":2983},{"type":20,"tag":194,"props":26968,"children":26969},{"class":196,"line":2203},[26970,26975],{"type":20,"tag":194,"props":26971,"children":26972},{"style":252},[26973],{"type":30,"value":26974},"                try",{"type":20,"tag":194,"props":26976,"children":26977},{"style":264},[26978],{"type":30,"value":13056},{"type":20,"tag":194,"props":26980,"children":26981},{"class":196,"line":2211},[26982,26986,26990,26994,26998],{"type":20,"tag":194,"props":26983,"children":26984},{"style":264},[26985],{"type":30,"value":26694},{"type":20,"tag":194,"props":26987,"children":26988},{"style":252},[26989],{"type":30,"value":461},{"type":20,"tag":194,"props":26991,"children":26992},{"style":264},[26993],{"type":30,"value":9118},{"type":20,"tag":194,"props":26995,"children":26996},{"style":258},[26997],{"type":30,"value":25670},{"type":20,"tag":194,"props":26999,"children":27000},{"style":264},[27001],{"type":30,"value":7399},{"type":20,"tag":194,"props":27003,"children":27004},{"class":196,"line":2219},[27005,27010,27014],{"type":20,"tag":194,"props":27006,"children":27007},{"style":264},[27008],{"type":30,"value":27009},"                }",{"type":20,"tag":194,"props":27011,"children":27012},{"style":252},[27013],{"type":30,"value":754},{"type":20,"tag":194,"props":27015,"children":27016},{"style":264},[27017],{"type":30,"value":13125},{"type":20,"tag":194,"props":27019,"children":27020},{"class":196,"line":2227},[27021,27025,27029,27033,27037,27041],{"type":20,"tag":194,"props":27022,"children":27023},{"style":264},[27024],{"type":30,"value":11802},{"type":20,"tag":194,"props":27026,"children":27027},{"style":258},[27028],{"type":30,"value":1186},{"type":20,"tag":194,"props":27030,"children":27031},{"style":264},[27032],{"type":30,"value":403},{"type":20,"tag":194,"props":27034,"children":27035},{"style":506},[27036],{"type":30,"value":25709},{"type":20,"tag":194,"props":27038,"children":27039},{"style":252},[27040],{"type":30,"value":649},{"type":20,"tag":194,"props":27042,"children":27043},{"style":264},[27044],{"type":30,"value":25548},{"type":20,"tag":194,"props":27046,"children":27047},{"class":196,"line":2236},[27048,27053],{"type":20,"tag":194,"props":27049,"children":27050},{"style":252},[27051],{"type":30,"value":27052},"                    return",{"type":20,"tag":194,"props":27054,"children":27055},{"style":264},[27056],{"type":30,"value":1384},{"type":20,"tag":194,"props":27058,"children":27059},{"class":196,"line":2245},[27060],{"type":20,"tag":194,"props":27061,"children":27062},{"style":264},[27063],{"type":30,"value":3048},{"type":20,"tag":194,"props":27065,"children":27066},{"class":196,"line":2254},[27067],{"type":20,"tag":194,"props":27068,"children":27069},{"style":264},[27070],{"type":30,"value":1121},{"type":20,"tag":194,"props":27072,"children":27073},{"class":196,"line":2262},[27074,27079,27083,27087,27091,27095,27099,27103,27107,27111,27115],{"type":20,"tag":194,"props":27075,"children":27076},{"style":252},[27077],{"type":30,"value":27078},"            else",{"type":20,"tag":194,"props":27080,"children":27081},{"style":252},[27082],{"type":30,"value":25754},{"type":20,"tag":194,"props":27084,"children":27085},{"style":264},[27086],{"type":30,"value":25311},{"type":20,"tag":194,"props":27088,"children":27089},{"style":258},[27090],{"type":30,"value":17086},{"type":20,"tag":194,"props":27092,"children":27093},{"style":264},[27094],{"type":30,"value":403},{"type":20,"tag":194,"props":27096,"children":27097},{"style":506},[27098],{"type":30,"value":25771},{"type":20,"tag":194,"props":27100,"children":27101},{"style":264},[27102],{"type":30,"value":514},{"type":20,"tag":194,"props":27104,"children":27105},{"style":252},[27106],{"type":30,"value":25332},{"type":20,"tag":194,"props":27108,"children":27109},{"style":252},[27110],{"type":30,"value":17109},{"type":20,"tag":194,"props":27112,"children":27113},{"style":680},[27114],{"type":30,"value":9401},{"type":20,"tag":194,"props":27116,"children":27117},{"style":264},[27118],{"type":30,"value":5702},{"type":20,"tag":194,"props":27120,"children":27121},{"class":196,"line":2286},[27122],{"type":20,"tag":194,"props":27123,"children":27124},{"style":264},[27125],{"type":30,"value":2983},{"type":20,"tag":194,"props":27127,"children":27128},{"class":196,"line":2295},[27129,27134,27138,27142,27146],{"type":20,"tag":194,"props":27130,"children":27131},{"style":264},[27132],{"type":30,"value":27133},"                res ",{"type":20,"tag":194,"props":27135,"children":27136},{"style":252},[27137],{"type":30,"value":461},{"type":20,"tag":194,"props":27139,"children":27140},{"style":264},[27141],{"type":30,"value":9118},{"type":20,"tag":194,"props":27143,"children":27144},{"style":258},[27145],{"type":30,"value":25819},{"type":20,"tag":194,"props":27147,"children":27148},{"style":264},[27149],{"type":30,"value":7399},{"type":20,"tag":194,"props":27151,"children":27152},{"class":196,"line":2319},[27153],{"type":20,"tag":194,"props":27154,"children":27155},{"style":264},[27156],{"type":30,"value":1121},{"type":20,"tag":194,"props":27158,"children":27159},{"class":196,"line":2328},[27160],{"type":20,"tag":194,"props":27161,"children":27162},{"emptyLinePlaceholder":546},[27163],{"type":30,"value":549},{"type":20,"tag":194,"props":27165,"children":27166},{"class":196,"line":2352},[27167,27171,27175,27180],{"type":20,"tag":194,"props":27168,"children":27169},{"style":264},[27170],{"type":30,"value":13144},{"type":20,"tag":194,"props":27172,"children":27173},{"style":258},[27174],{"type":30,"value":1177},{"type":20,"tag":194,"props":27176,"children":27177},{"style":264},[27178],{"type":30,"value":27179},"(res); ",{"type":20,"tag":194,"props":27181,"children":27182},{"style":201},[27183],{"type":30,"value":27184},"// Finished (call .done)\n",{"type":20,"tag":194,"props":27186,"children":27187},{"class":196,"line":2361},[27188],{"type":20,"tag":194,"props":27189,"children":27190},{"style":264},[27191],{"type":30,"value":2779},{"type":20,"tag":194,"props":27193,"children":27194},{"class":196,"line":2381},[27195],{"type":20,"tag":194,"props":27196,"children":27197},{"emptyLinePlaceholder":546},[27198],{"type":30,"value":549},{"type":20,"tag":194,"props":27200,"children":27201},{"class":196,"line":2389},[27202,27206,27210],{"type":20,"tag":194,"props":27203,"children":27204},{"style":264},[27205],{"type":30,"value":26492},{"type":20,"tag":194,"props":27207,"children":27208},{"style":258},[27209],{"type":30,"value":25871},{"type":20,"tag":194,"props":27211,"children":27212},{"style":264},[27213],{"type":30,"value":539},{"type":20,"tag":194,"props":27215,"children":27216},{"class":196,"line":2437},[27217],{"type":20,"tag":194,"props":27218,"children":27219},{"emptyLinePlaceholder":546},[27220],{"type":30,"value":549},{"type":20,"tag":194,"props":27222,"children":27223},{"class":196,"line":2465},[27224,27228,27232,27236],{"type":20,"tag":194,"props":27225,"children":27226},{"style":252},[27227],{"type":30,"value":1591},{"type":20,"tag":194,"props":27229,"children":27230},{"style":264},[27231],{"type":30,"value":10479},{"type":20,"tag":194,"props":27233,"children":27234},{"style":258},[27235],{"type":30,"value":10027},{"type":20,"tag":194,"props":27237,"children":27238},{"style":264},[27239],{"type":30,"value":539},{"type":20,"tag":194,"props":27241,"children":27242},{"class":196,"line":2518},[27243],{"type":20,"tag":194,"props":27244,"children":27245},{"style":264},[27246],{"type":30,"value":1657},{"type":20,"tag":194,"props":27248,"children":27249},{"class":196,"line":2526},[27250],{"type":20,"tag":194,"props":27251,"children":27252},{"emptyLinePlaceholder":546},[27253],{"type":30,"value":549},{"type":20,"tag":194,"props":27255,"children":27256},{"class":196,"line":2567},[27257],{"type":20,"tag":194,"props":27258,"children":27259},{"style":201},[27260],{"type":30,"value":27261},"/*\n",{"type":20,"tag":194,"props":27263,"children":27264},{"class":196,"line":2580},[27265],{"type":20,"tag":194,"props":27266,"children":27267},{"style":201},[27268],{"type":30,"value":27269},"* This allows us the option to call $('#myForm').transparentSubmit - as you can see, its just a slightly different form \n",{"type":20,"tag":194,"props":27271,"children":27272},{"class":196,"line":2597},[27273],{"type":20,"tag":194,"props":27274,"children":27275},{"style":201},[27276],{"type":30,"value":27277},"* to the plugin, which calls our transparentSubmit function as defined above.\n",{"type":20,"tag":194,"props":27279,"children":27280},{"class":196,"line":2669},[27281],{"type":20,"tag":194,"props":27282,"children":27283},{"style":201},[27284],{"type":30,"value":19134},{"type":20,"tag":194,"props":27286,"children":27287},{"class":196,"line":2697},[27288,27292,27296,27300,27304,27308,27312],{"type":20,"tag":194,"props":27289,"children":27290},{"style":264},[27291],{"type":30,"value":18144},{"type":20,"tag":194,"props":27293,"children":27294},{"style":258},[27295],{"type":30,"value":24420},{"type":20,"tag":194,"props":27297,"children":27298},{"style":252},[27299],{"type":30,"value":3298},{"type":20,"tag":194,"props":27301,"children":27302},{"style":252},[27303],{"type":30,"value":3303},{"type":20,"tag":194,"props":27305,"children":27306},{"style":264},[27307],{"type":30,"value":403},{"type":20,"tag":194,"props":27309,"children":27310},{"style":406},[27311],{"type":30,"value":12047},{"type":20,"tag":194,"props":27313,"children":27314},{"style":264},[27315],{"type":30,"value":4253},{"type":20,"tag":194,"props":27317,"children":27318},{"class":196,"line":2714},[27319,27324,27328,27332],{"type":20,"tag":194,"props":27320,"children":27321},{"style":264},[27322],{"type":30,"value":27323},"        options.form ",{"type":20,"tag":194,"props":27325,"children":27326},{"style":252},[27327],{"type":30,"value":461},{"type":20,"tag":194,"props":27329,"children":27330},{"style":680},[27331],{"type":30,"value":4142},{"type":20,"tag":194,"props":27333,"children":27334},{"style":264},[27335],{"type":30,"value":1384},{"type":20,"tag":194,"props":27337,"children":27338},{"class":196,"line":2723},[27339,27343,27347,27351],{"type":20,"tag":194,"props":27340,"children":27341},{"style":252},[27342],{"type":30,"value":1591},{"type":20,"tag":194,"props":27344,"children":27345},{"style":264},[27346],{"type":30,"value":9118},{"type":20,"tag":194,"props":27348,"children":27349},{"style":258},[27350],{"type":30,"value":24420},{"type":20,"tag":194,"props":27352,"children":27353},{"style":264},[27354],{"type":30,"value":27355},"(options);\n",{"type":20,"tag":194,"props":27357,"children":27358},{"class":196,"line":2736},[27359],{"type":20,"tag":194,"props":27360,"children":27361},{"style":264},[27362],{"type":30,"value":3940},{"type":20,"tag":194,"props":27364,"children":27365},{"class":196,"line":2765},[27366],{"type":20,"tag":194,"props":27367,"children":27368},{"style":264},[27369],{"type":30,"value":18219},{"type":20,"tag":3951,"props":27371,"children":27372},{},[27373],{"type":30,"value":3955},{"title":8,"searchDepth":216,"depth":216,"links":27375},[27376,27377,27378,27379,27380],{"id":24020,"depth":207,"text":24023},{"id":24590,"depth":207,"text":24593},{"id":24750,"depth":207,"text":24753},{"id":25909,"depth":207,"text":25912},{"id":25920,"depth":207,"text":25923},"content:ckeefer:2013-3:ajax-upload.md","ckeefer/2013-3/ajax-upload.md","ckeefer/2013-3/ajax-upload",{"user":3970,"name":3971},1780330271051]