| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309 | $(function() {	// Helper function for vertically aligning DOM elements	// http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/	$.fn.vAlign = function() {		return this.each(function(i){		var ah = $(this).height();		var ph = $(this).parent().height();		var mh = (ph - ah) / 2;		$(this).css('margin-top', mh);		});	};	$.fn.stretchFormtasticInputWidthToParent = function() {		return this.each(function(i){		var p_width = $(this).closest("form").innerWidth();		var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);		var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);		$(this).css('width', p_width - p_padding - this_padding);		});	};	$('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();	// Vertically center these paragraphs	// Parent may need a min-height for this to work..	$('ul.downplayed li div.content p').vAlign();	// When a sandbox form is submitted..	$("form.sandbox").submit(function(){		var error_free = true;		// Cycle through the forms required inputs 		$(this).find("input.required").each(function() {			// Remove any existing error styles from the input			$(this).removeClass('error');			// Tack the error style on if the input is empty..			if ($(this).val() == '') {				$(this).addClass('error');				$(this).wiggle();				error_free = false;			}		});		return error_free;	});});function clippyCopiedCallback(a) {  $('#api_key_copied').fadeIn().delay(1000).fadeOut();  // var b = $("#clippy_tooltip_" + a);  // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {  //   b.attr("title", "copy to clipboard")  // },  // 500))}// Logging function that accounts for browsers that don't have window.consolefunction log() {  if (window.console) console.log.apply(console,arguments);}  var Docs = {	shebang: function() {		// If shebang has an operation nickname in it..		// e.g. /docs/#!/words/get_search		var fragments = $.param.fragment().split('/');		fragments.shift(); // get rid of the bang		switch (fragments.length) {			case 1:				// Expand all operations for the resource and scroll to it//				log('shebang resource:' + fragments[0]);				var dom_id = 'resource_' + fragments[0];				Docs.expandEndpointListForResource(fragments[0]);				$("#"+dom_id).slideto({highlight: false});				break;			case 2:				// Refer to the endpoint DOM element, e.g. #words_get_search//				log('shebang endpoint: ' + fragments.join('_'));                // Expand Resource                Docs.expandEndpointListForResource(fragments[0]);                $("#"+dom_id).slideto({highlight: false});                // Expand operation				var li_dom_id = fragments.join('_');				var li_content_dom_id = li_dom_id + "_content";//                log("li_dom_id " + li_dom_id);//                log("li_content_dom_id " + li_content_dom_id);				Docs.expandOperation($('#'+li_content_dom_id));				$('#'+li_dom_id).slideto({highlight: false});				break;		}	},	toggleEndpointListForResource: function(resource) {		var elem = $('li#resource_' + resource + ' ul.endpoints');		if (elem.is(':visible')) {			Docs.collapseEndpointListForResource(resource);		} else {			Docs.expandEndpointListForResource(resource);		}	},	// Expand resource	expandEndpointListForResource: function(resource) {		$('#resource_' + resource).addClass('active');		var elem = $('li#resource_' + resource + ' ul.endpoints');		elem.slideDown();	},	// Collapse resource and mark as explicitly closed	collapseEndpointListForResource: function(resource) {		$('#resource_' + resource).removeClass('active');		var elem = $('li#resource_' + resource + ' ul.endpoints');		elem.slideUp();	},	expandOperationsForResource: function(resource) {		// Make sure the resource container is open..		Docs.expandEndpointListForResource(resource);		$('li#resource_' + resource + ' li.operation div.content').each(function() {			Docs.expandOperation($(this));		});	},	collapseOperationsForResource: function(resource) {		// Make sure the resource container is open..		Docs.expandEndpointListForResource(resource);		$('li#resource_' + resource + ' li.operation div.content').each(function() {			Docs.collapseOperation($(this));		});	},	expandOperation: function(elem) {		elem.slideDown();	},	collapseOperation: function(elem) {		elem.slideUp();	}};(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;  buffer += "\n<div class='container' id='resources_container'>\n    <ul id='resources'>\n    </ul>\n\n    <div class=\"footer\">\n        <br>\n        <br>\n        <h4 style=\"color: #999\">[<span style=\"font-variant: small-caps\">base url</span>: ";  foundHelper = helpers.basePath;  stack1 = foundHelper || depth0.basePath;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "basePath", { hash: {} }); }  buffer += escapeExpression(stack1) + "]</h4>\n    </div>\n</div>";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;function program1(depth0,data) {    var buffer = "", stack1;  buffer += "\n                <h4>Implementation Notes</h4>\n                <p>";  foundHelper = helpers.notes;  stack1 = foundHelper || depth0.notes;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "notes", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</p>\n                ";  return buffer;}function program3(depth0,data) {      return "\n                    ";}function program5(depth0,data) {      return "\n                    <div class='sandbox_header'>\n                        <input class='submit' name='commit' type='button' value='Try it out!' />\n                        <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n                        <img alt='Throbber' class='response_throbber' src='http://swagger.wordnik.com/images/throbber.gif' style='display:none' />\n                    </div>\n                    ";}  buffer += "\n    <ul class='operations' >\n        <li class='";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + " operation' id='";  foundHelper = helpers.resourceName;  stack1 = foundHelper || depth0.resourceName;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.nickname;  stack1 = foundHelper || depth0.nickname;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>\n            <div class='heading'>\n                <h3>\n                  <span class='http_method'>\n                    <a href='#!/";  foundHelper = helpers.resourceName;  stack1 = foundHelper || depth0.resourceName;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }  buffer += escapeExpression(stack1) + "/";  foundHelper = helpers.nickname;  stack1 = foundHelper || depth0.nickname;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + "</a>\n                  </span>\n                  <span class='path'>\n                    <a href='#!/";  foundHelper = helpers.resourceName;  stack1 = foundHelper || depth0.resourceName;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }  buffer += escapeExpression(stack1) + "/";  foundHelper = helpers.nickname;  stack1 = foundHelper || depth0.nickname;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";  foundHelper = helpers.pathJson;  stack1 = foundHelper || depth0.pathJson;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "pathJson", { hash: {} }); }  buffer += escapeExpression(stack1) + "</a>\n                  </span>\n                </h3>\n                <ul class='options'>\n                    <li>\n                        <a href='#!/";  foundHelper = helpers.resourceName;  stack1 = foundHelper || depth0.resourceName;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }  buffer += escapeExpression(stack1) + "/";  foundHelper = helpers.nickname;  stack1 = foundHelper || depth0.nickname;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + "' class=\"toggleOperation\">";  foundHelper = helpers.summary;  stack1 = foundHelper || depth0.summary;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "summary", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</a>\n                    </li>\n                </ul>\n            </div>\n            <div class='content' id='";  foundHelper = helpers.resourceName;  stack1 = foundHelper || depth0.resourceName;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "resourceName", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.nickname;  stack1 = foundHelper || depth0.nickname;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "nickname", { hash: {} }); }  buffer += escapeExpression(stack1) + "_";  foundHelper = helpers.httpMethod;  stack1 = foundHelper || depth0.httpMethod;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "httpMethod", { hash: {} }); }  buffer += escapeExpression(stack1) + "_content' style='display:none'>\n                ";  foundHelper = helpers.notes;  stack1 = foundHelper || depth0.notes;  stack2 = helpers['if'];  tmp1 = self.program(1, program1, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.noop;  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n                <form accept-charset='UTF-8' action='#' class='sandbox' method='post'>\n                    <div style='margin:0;padding:0;display:inline'></div>\n                    <h4>Parameters</h4>\n                    <table class='fullwidth'>\n                        <thead>\n                        <tr>\n                            <th>Parameter</th>\n                            <th>Value</th>\n                            <th>Description</th>\n                        </tr>\n                        </thead>\n                        <tbody class=\"operation-params\">\n\n                        </tbody>\n                    </table>\n                    ";  foundHelper = helpers.isReadOnly;  stack1 = foundHelper || depth0.isReadOnly;  stack2 = helpers['if'];  tmp1 = self.program(3, program3, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(5, program5, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n                </form>\n                <div class='response' style='display:none'>\n                    <h4>Request URL</h4>\n                    <div class='block request_url'></div>\n                    <h4>Response Body</h4>\n                    <div class='block response_body'></div>\n                    <h4>Response Code</h4>\n                    <div class='block response_code'></div>\n                    <h4>Response Headers</h4>\n                    <div class='block response_headers'></div>\n                </div>\n            </div>\n        </li>\n    </ul>\n";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;function program1(depth0,data) {    var buffer = "", stack1, stack2;  buffer += "\n		";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  stack2 = helpers['if'];  tmp1 = self.program(2, program2, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(4, program4, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n		\n	";  return buffer;}function program2(depth0,data) {    var buffer = "", stack1;  buffer += "\n			<textarea class='body-textarea' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "</textarea>\n		";  return buffer;}function program4(depth0,data) {    var buffer = "", stack1;  buffer += "\n		    <textarea class='body-textarea' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'></textarea>\n		";  return buffer;}function program6(depth0,data) {    var buffer = "", stack1, stack2;  buffer += "\n		";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  stack2 = helpers['if'];  tmp1 = self.program(7, program7, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(9, program9, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n	";  return buffer;}function program7(depth0,data) {    var buffer = "", stack1;  buffer += "\n			<input minlength='0' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "' placeholder='' type='text' value='";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "'/>\n		";  return buffer;}function program9(depth0,data) {    var buffer = "", stack1;  buffer += "\n		    <input minlength='0' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "' placeholder='' type='text' value=''/>\n		";  return buffer;}  buffer += "<td class='code'>";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "</td>\n<td>\n	\n	";  foundHelper = helpers.isBody;  stack1 = foundHelper || depth0.isBody;  stack2 = helpers['if'];  tmp1 = self.program(1, program1, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(6, program6, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n\n</td>\n<td width='500'>";  foundHelper = helpers.description;  stack1 = foundHelper || depth0.description;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</td>\n\n";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;function program1(depth0,data) {      return "\n        ";}function program3(depth0,data) {    var buffer = "", stack1, stack2;  buffer += "\n            ";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  stack2 = helpers['if'];  tmp1 = self.program(4, program4, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(6, program6, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n        ";  return buffer;}function program4(depth0,data) {      return "\n            ";}function program6(depth0,data) {      return "\n                <option selected=\"\" value=''></option>\n            ";}function program8(depth0,data) {    var buffer = "", stack1, stack2;  buffer += "\n            ";  foundHelper = helpers.isDefault;  stack1 = foundHelper || depth0.isDefault;  stack2 = helpers['if'];  tmp1 = self.program(9, program9, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(11, program11, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n        ";  return buffer;}function program9(depth0,data) {    var buffer = "", stack1;  buffer += "\n                <option value='";  foundHelper = helpers.value;  stack1 = foundHelper || depth0.value;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>";  foundHelper = helpers.value;  stack1 = foundHelper || depth0.value;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }  buffer += escapeExpression(stack1) + " (default)</option>\n            ";  return buffer;}function program11(depth0,data) {    var buffer = "", stack1;  buffer += "\n                <option value='";  foundHelper = helpers.value;  stack1 = foundHelper || depth0.value;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>";  foundHelper = helpers.value;  stack1 = foundHelper || depth0.value;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "value", { hash: {} }); }  buffer += escapeExpression(stack1) + "</option>\n            ";  return buffer;}  buffer += "<td class='code'>";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "</td>\n<td>\n    <select name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>\n        ";  foundHelper = helpers.required;  stack1 = foundHelper || depth0.required;  stack2 = helpers['if'];  tmp1 = self.program(1, program1, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(3, program3, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n        ";  foundHelper = helpers.allowableValues;  stack1 = foundHelper || depth0.allowableValues;  stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.descriptiveValues);  stack2 = helpers.each;  tmp1 = self.program(8, program8, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.noop;  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n    </select>\n</td>\n<td width='500'>";  foundHelper = helpers.description;  stack1 = foundHelper || depth0.description;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</td>\n\n";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;function program1(depth0,data) {    var buffer = "", stack1;  buffer += "\n        <textarea class='body-textarea' readonly='readonly' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "</textarea>\n    ";  return buffer;}function program3(depth0,data) {    var buffer = "", stack1;  buffer += "\n        ";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "\n    ";  return buffer;}  buffer += "<td class='code'>";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "</td>\n<td>\n    ";  foundHelper = helpers.isBody;  stack1 = foundHelper || depth0.isBody;  stack2 = helpers['if'];  tmp1 = self.program(1, program1, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(3, program3, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n</td>\n<td width='500'>";  foundHelper = helpers.description;  stack1 = foundHelper || depth0.description;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</td>\n\n";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;function program1(depth0,data) {    var buffer = "", stack1;  buffer += "\n        <textarea class='body-textarea'  readonly='readonly' placeholder='(required)' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "</textarea>\n    ";  return buffer;}function program3(depth0,data) {    var buffer = "", stack1;  buffer += "\n        ";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "\n    ";  return buffer;}  buffer += "<td class='code required'>";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "</td>\n<td>\n    ";  foundHelper = helpers.isBody;  stack1 = foundHelper || depth0.isBody;  stack2 = helpers['if'];  tmp1 = self.program(1, program1, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(3, program3, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n</td>\n<td width='500'>";  foundHelper = helpers.description;  stack1 = foundHelper || depth0.description;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</td>\n";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, stack2, foundHelper, tmp1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;function program1(depth0,data) {    var buffer = "", stack1, stack2;  buffer += "\n		";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  stack2 = helpers['if'];  tmp1 = self.program(2, program2, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(4, program4, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n		\n	";  return buffer;}function program2(depth0,data) {    var buffer = "", stack1;  buffer += "\n			<textarea class='body-textarea' placeholder='(required)' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "</textarea>\n		";  return buffer;}function program4(depth0,data) {    var buffer = "", stack1;  buffer += "\n		    <textarea class='body-textarea' placeholder='(required)' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'></textarea>\n		";  return buffer;}function program6(depth0,data) {    var buffer = "", stack1, stack2;  buffer += "\n		";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  stack2 = helpers['if'];  tmp1 = self.program(7, program7, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(9, program9, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n	";  return buffer;}function program7(depth0,data) {    var buffer = "", stack1;  buffer += "\n		    <input class='required' minlength='1' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value='";  foundHelper = helpers.defaultValue;  stack1 = foundHelper || depth0.defaultValue;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "defaultValue", { hash: {} }); }  buffer += escapeExpression(stack1) + "'/>\n		";  return buffer;}function program9(depth0,data) {    var buffer = "", stack1;  buffer += "\n		    <input class='required' minlength='1' name='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "' placeholder='(required)' type='text' value=''/>\n		";  return buffer;}  buffer += "<td class='code required'>";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "</td>\n<td>\n	";  foundHelper = helpers.isBody;  stack1 = foundHelper || depth0.isBody;  stack2 = helpers['if'];  tmp1 = self.program(1, program1, data);  tmp1.hash = {};  tmp1.fn = tmp1;  tmp1.inverse = self.program(6, program6, data);  stack1 = stack2.call(depth0, stack1, tmp1);  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "\n</td>\n<td width='500'>\n    <strong>";  foundHelper = helpers.description;  stack1 = foundHelper || depth0.description;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "description", { hash: {} }); }  if(stack1 || stack1 === 0) { buffer += stack1; }  buffer += "</strong>\n</td>\n";  return buffer;});})();(function() {  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) {  helpers = helpers || Handlebars.helpers;  var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;  buffer += "<div class='heading'>\n    <h2>\n        <a href='#!/";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "' onclick=\"Docs.toggleEndpointListForResource('";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "');\">/";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "</a>\n    </h2>\n    <ul class='options'>\n        <li>\n            <a href='#!/";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "' id='endpointListTogger_";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'\n               onclick=\"Docs.toggleEndpointListForResource('";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "');\">Show/Hide</a>\n        </li>\n        <li>\n            <a href='#' onclick=\"Docs.collapseOperationsForResource('";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'); return false;\">\n                List Operations\n            </a>\n        </li>\n        <li>\n            <a href='#' onclick=\"Docs.expandOperationsForResource('";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "'); return false;\">\n                Expand Operations\n            </a>\n        </li>\n        <li>\n            <a href='";  foundHelper = helpers.url;  stack1 = foundHelper || depth0.url;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "url", { hash: {} }); }  buffer += escapeExpression(stack1) + "'>Raw</a>\n        </li>\n    </ul>\n</div>\n<ul class='endpoints' id='";  foundHelper = helpers.name;  stack1 = foundHelper || depth0.name;  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "name", { hash: {} }); }  buffer += escapeExpression(stack1) + "_endpoint_list' style='display:none'>\n\n</ul>\n";  return buffer;});})();// Generated by CoffeeScript 1.3.3(function() {  var HeaderView, MainView, OperationView, ParameterView, ResourceView, SwaggerUi,    __hasProp = {}.hasOwnProperty,    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };  SwaggerUi = (function(_super) {    __extends(SwaggerUi, _super);    function SwaggerUi() {      return SwaggerUi.__super__.constructor.apply(this, arguments);    }    SwaggerUi.prototype.routes = {      '': 'load'    };    SwaggerUi.prototype.dom_id = "swagger_ui";    SwaggerUi.prototype.options = null;    SwaggerUi.prototype.api = null;    SwaggerUi.prototype.headerView = null;    SwaggerUi.prototype.mainView = null;    SwaggerUi.prototype.initialize = function(options) {      var _this = this;      if (options == null) {        options = {};      }      if (options.dom_id != null) {        this.dom_id = options.dom_id;        delete options.dom_id;      }      if (!($('#' + this.dom_id) != null)) {        $('body').append('<div id="' + this.dom_id + '"></div>');      }      this.options = options;      this.options.success = function() {        return _this.render();      };      this.options.progress = function(d) {        return _this.showMessage(d);      };      this.options.failure = function(d) {        return _this.onLoadFailure(d);      };      this.headerView = new HeaderView({        el: $('#header')      });      return this.headerView.on('update-swagger-ui', function(data) {        return _this.updateSwaggerUi(data);      });    };    SwaggerUi.prototype.updateSwaggerUi = function(data) {      this.options.discoveryUrl = data.discoveryUrl;      this.options.apiKey = data.apiKey;      return this.load();    };    SwaggerUi.prototype.load = function() {      var _ref;      if ((_ref = this.mainView) != null) {        _ref.clear();      }      this.headerView.update(this.options.discoveryUrl, this.options.apiKey);      this.api = new SwaggerApi(this.options);      return Backbone.history.start({        pushState: true      });    };    SwaggerUi.prototype.render = function() {      var _this = this;      this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');      this.mainView = new MainView({        model: this.api,        el: $('#' + this.dom_id)      }).render();      this.showMessage();      return setTimeout(function() {        return Docs.shebang();      }, 400);    };    SwaggerUi.prototype.showMessage = function(data) {      if (data == null) {        data = '';      }      $('#message-bar').removeClass('message-fail');      $('#message-bar').addClass('message-success');      return $('#message-bar').html(data);    };    SwaggerUi.prototype.onLoadFailure = function(data) {      if (data == null) {        data = '';      }      $('#message-bar').removeClass('message-success');      $('#message-bar').addClass('message-fail');      return $('#message-bar').html(data);    };    return SwaggerUi;  })(Backbone.Router);  window.SwaggerUi = SwaggerUi;  HeaderView = (function(_super) {    __extends(HeaderView, _super);    function HeaderView() {      return HeaderView.__super__.constructor.apply(this, arguments);    }    HeaderView.prototype.events = {      'click #show-pet-store-icon': 'showPetStore',      'click #show-wordnik-dev-icon': 'showWordnikDev',      'click #explore': 'showCustom',      'keyup #input_baseUrl': 'showCustomOnKeyup',      'keyup #input_apiKey': 'showCustomOnKeyup'    };    HeaderView.prototype.initialize = function() {};    HeaderView.prototype.showPetStore = function(e) {      return this.trigger('update-swagger-ui', {        discoveryUrl: "http://petstore.swagger.wordnik.com/api/resources.json",        apiKey: "special-key"      });    };    HeaderView.prototype.showWordnikDev = function(e) {      return this.trigger('update-swagger-ui', {        discoveryUrl: "http://api.wordnik.com/v4/resources.json",        apiKey: ""      });    };    HeaderView.prototype.showCustomOnKeyup = function(e) {      if (e.keyCode === 13) {        return this.showCustom();      }    };    HeaderView.prototype.showCustom = function(e) {      if (e != null) {        e.preventDefault();      }      return this.trigger('update-swagger-ui', {        discoveryUrl: $('#input_baseUrl').val(),        apiKey: $('#input_apiKey').val()      });    };    HeaderView.prototype.update = function(url, apiKey, trigger) {      if (trigger == null) {        trigger = false;      }      $('#input_baseUrl').val(url);      $('#input_apiKey').val(apiKey);      if (trigger) {        return this.trigger('update-swagger-ui', {          discoveryUrl: url,          apiKey: apiKey        });      }    };    return HeaderView;  })(Backbone.View);  MainView = (function(_super) {    __extends(MainView, _super);    function MainView() {      return MainView.__super__.constructor.apply(this, arguments);    }    MainView.prototype.initialize = function() {};    MainView.prototype.render = function() {      var resource, _i, _len, _ref;      $(this.el).html(Handlebars.templates.main(this.model));      _ref = this.model.resourcesArray;      for (_i = 0, _len = _ref.length; _i < _len; _i++) {        resource = _ref[_i];        this.addResource(resource);      }      return this;    };    MainView.prototype.addResource = function(resource) {      var resourceView;      resourceView = new ResourceView({        model: resource,        tagName: 'li',        id: 'resource_' + resource.name,        className: 'resource'      });      return $('#resources').append(resourceView.render().el);    };    MainView.prototype.clear = function() {      return $(this.el).html('');    };    return MainView;  })(Backbone.View);  ResourceView = (function(_super) {    __extends(ResourceView, _super);    function ResourceView() {      return ResourceView.__super__.constructor.apply(this, arguments);    }    ResourceView.prototype.initialize = function() {};    ResourceView.prototype.render = function() {      var operation, _i, _len, _ref;      $(this.el).html(Handlebars.templates.resource(this.model));      _ref = this.model.operationsArray;      for (_i = 0, _len = _ref.length; _i < _len; _i++) {        operation = _ref[_i];        this.addOperation(operation);      }      return this;    };    ResourceView.prototype.addOperation = function(operation) {      var operationView;      operationView = new OperationView({        model: operation,        tagName: 'li',        className: 'endpoint'      });      return $('.endpoints', $(this.el)).append(operationView.render().el);    };    return ResourceView;  })(Backbone.View);  OperationView = (function(_super) {    __extends(OperationView, _super);    function OperationView() {      return OperationView.__super__.constructor.apply(this, arguments);    }    OperationView.prototype.events = {      'click .submit': 'submitOperation',      'click .response_hider': 'hideResponse',      'click .toggleOperation': 'toggleOperationContent'    };    OperationView.prototype.initialize = function() {};    OperationView.prototype.render = function() {      var isMethodSubmissionSupported, param, _i, _len, _ref;      isMethodSubmissionSupported = jQuery.inArray(this.model.httpMethod, this.model.supportedSubmitMethods()) >= 0;      if (!isMethodSubmissionSupported) {        this.model.isReadOnly = true;      }      $(this.el).html(Handlebars.templates.operation(this.model));      _ref = this.model.parameters;      for (_i = 0, _len = _ref.length; _i < _len; _i++) {        param = _ref[_i];        this.addParameter(param);      }      return this;    };    OperationView.prototype.addParameter = function(param) {      var paramView;      paramView = new ParameterView({        model: param,        tagName: 'tr',        readOnly: this.model.isReadOnly      });      return $('.operation-params', $(this.el)).append(paramView.render().el);    };    OperationView.prototype.submitOperation = function() {      var bodyParam, error_free, form, headerParams, invocationUrl, map, o, obj, param, _i, _j, _len, _len1, _ref, _ref1,        _this = this;      form = $('.sandbox', $(this.el));      error_free = true;      form.find("input.required").each(function() {        var _this = this;        $(this).removeClass("error");        if (jQuery.trim($(this).val()) === "") {          $(this).addClass("error");          $(this).wiggle({            callback: function() {              return $(_this).focus();            }          });          return error_free = false;        }      });      if (error_free) {        map = {};        _ref = form.serializeArray();        for (_i = 0, _len = _ref.length; _i < _len; _i++) {          o = _ref[_i];          if ((o.value != null) && jQuery.trim(o.value).length > 0) {            map[o.name] = o.value;          }        }        bodyParam = null;        _ref1 = this.model.parameters;        for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {          param = _ref1[_j];          if (param.paramType === 'body') {            bodyParam = map[param.name];          }        }        log("bodyParam = " + bodyParam);        headerParams = null;        invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);        log('submitting ' + invocationUrl);        $(".request_url", $(this.el)).html("<pre>" + invocationUrl + "</pre>");        $(".response_throbber", $(this.el)).show();        obj = {          type: this.model.httpMethod,          url: invocationUrl,          headers: headerParams,          data: bodyParam,          dataType: 'json',          error: function(xhr, textStatus, error) {            return _this.showErrorStatus(xhr, textStatus, error);          },          success: function(data) {            return _this.showResponse(data);          },          complete: function(data) {            return _this.showCompleteStatus(data);          }        };        if (obj.type.toLowerCase() === "post" || obj.type.toLowerCase() === "put") {          obj.contentType = "application/json";        }        return jQuery.ajax(obj);      }    };    OperationView.prototype.hideResponse = function(e) {      if (e != null) {        e.preventDefault();      }      $(".response", $(this.el)).slideUp();      return $(".response_hider", $(this.el)).fadeOut();    };    OperationView.prototype.showResponse = function(response) {      var prettyJson;      prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");      return $(".response_body", $(this.el)).html(prettyJson);    };    OperationView.prototype.showErrorStatus = function(data) {      return this.showStatus(data);    };    OperationView.prototype.showCompleteStatus = function(data) {      return this.showStatus(data);    };    OperationView.prototype.showStatus = function(data) {      var response_body;      try {        response_body = "<pre>" + JSON.stringify(JSON.parse(data.responseText), null, 2).replace(/\n/g, "<br>") + "</pre>";      } catch (error) {        response_body = "<span style='color:red'>   [unable to parse as json; raw response below]</span><br><pre>" + data.responseText + "</pre>";      }      $(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");      $(".response_body", $(this.el)).html(response_body);      $(".response_headers", $(this.el)).html("<pre>" + data.getAllResponseHeaders() + "</pre>");      $(".response", $(this.el)).slideDown();      $(".response_hider", $(this.el)).show();      return $(".response_throbber", $(this.el)).hide();    };    OperationView.prototype.toggleOperationContent = function() {      var elem;      elem = $('#' + this.model.resourceName + "_" + this.model.nickname + "_" + this.model.httpMethod + "_content");      if (elem.is(':visible')) {        return Docs.collapseOperation(elem);      } else {        return Docs.expandOperation(elem);      }    };    return OperationView;  })(Backbone.View);  ParameterView = (function(_super) {    __extends(ParameterView, _super);    function ParameterView() {      return ParameterView.__super__.constructor.apply(this, arguments);    }    ParameterView.prototype.initialize = function() {};    ParameterView.prototype.render = function() {      var template;      if (this.model.paramType === 'body') {        this.model.isBody = true;      }      template = this.template();      $(this.el).html(template(this.model));      return this;    };    ParameterView.prototype.template = function() {      if (this.model.isList) {        return Handlebars.templates.param_list;      } else {        if (this.options.readOnly) {          if (this.model.required) {            return Handlebars.templates.param_readonly_required;          } else {            return Handlebars.templates.param_readonly;          }        } else {          if (this.model.required) {            return Handlebars.templates.param_required;          } else {            return Handlebars.templates.param;          }        }      }    };    return ParameterView;  })(Backbone.View);}).call(this);
 |