/*! ** Unobtrusive Ajax support library for jQuery ** Copyright (C) Microsoft Corporation. All rights reserved. */(function(e){var t="unobtrusiveAjaxClick",s="unobtrusiveAjaxClickTarget",a="unobtrusiveValidation";function n(e,t){for(var n=window,s=(e||"").split(".");n&&s.length;)n=n[s.shift()];return typeof n=="function"?n:(t.push(e),Function.constructor.apply(null,t))}function o(e){return e==="GET"||e==="POST"}function r(e,t){o(t)||e.setRequestHeader("X-HTTP-Method-Override",t)}function c(t,n,s){var o;if(s.indexOf("application/x-javascript")!==-1)return;o=(t.getAttribute("data-ajax-mode")||"").toUpperCase(),e(t.getAttribute("data-ajax-update")).each(function(t,s){var i;switch(o){case"BEFORE":i=s.firstChild,e("
").html(n).contents().each(function(){s.insertBefore(this,i)});break;case"AFTER":e("
").html(n).contents().each(function(){s.appendChild(this)});break;case"REPLACE-WITH":e(s).replaceWith(n);break;default:e(s).html(n);break}})}function i(t,s){var i,a,l,d=t.getAttribute("data-ajax-confirm");if(d&&!window.confirm(d))return;a=e(t.getAttribute("data-ajax-loading")),l=parseInt(t.getAttribute("data-ajax-loading-duration"),10)||0,e.extend(s,{type:t.getAttribute("data-ajax-method")||void 0,url:t.getAttribute("data-ajax-url")||void 0,cache:!!t.getAttribute("data-ajax-cache"),beforeSend:function(e){var s;return r(e,i),s=n(t.getAttribute("data-ajax-begin"),["xhr"]).apply(t,arguments),s!==!1&&a.show(l),s},complete:function(){a.hide(l),n(t.getAttribute("data-ajax-complete"),["xhr","status"]).apply(t,arguments)},success:function(e,s,o){c(t,e,o.getResponseHeader("Content-Type")||"text/html"),n(t.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(t,arguments)},error:function(){n(t.getAttribute("data-ajax-failure"),["xhr","status","error"]).apply(t,arguments)}}),s.data.push({name:"X-Requested-With",value:"XMLHttpRequest"}),i=s.type.toUpperCase(),o(i)||(s.type="POST",s.data.push({name:"X-HTTP-Method-Override",value:i})),e.ajax(s)}function l(t){var n=e(t).data(a);return!n||!n.validate||n.validate()}e(document).on("click","a[data-ajax=true]",function(e){e.preventDefault(),i(this,{url:this.href,type:"GET",data:[]})}),e(document).on("click","form[data-ajax=true] input[type=image]",function(n){var s=n.target.name,o=e(n.target),i=e(o.parents("form")[0]),a=o.offset();i.data(t,[{name:s+".x",value:Math.round(n.pageX-a.left)},{name:s+".y",value:Math.round(n.pageY-a.top)}]),setTimeout(function(){i.removeData(t)},0)}),e(document).on("click","form[data-ajax=true] :submit",function(n){var i=n.currentTarget.name,a=e(n.target),o=e(a.parents("form")[0]);o.data(t,i?[{name:i,value:n.currentTarget.value}]:[]),o.data(s,a),setTimeout(function(){o.removeData(t),o.removeData(s)},0)}),e(document).on("submit","form[data-ajax=true]",function(n){var a=e(this).data(t)||[],o=e(this).data(s),r=o&&o.hasClass("cancel");if(n.preventDefault(),!r&&!l(this))return;i(this,{url:this.action,type:this.method||"GET",data:a.concat(e(this).serializeArray())})})})(jQuery)