diff -r 000000000000 -r bca7a7e058a3 src/pyams_skin/resources/js/myams-ajax.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/myams-ajax.min.js Thu Feb 13 11:43:31 2020 +0100 @@ -0,0 +1,1 @@ +!function(p,g){var h=g.MyAMS;h.ajax={check:function(e,t,a,o){function n(e,t){if(void 0!==a){a instanceof Array||(a=[a]);for(var o=0;o=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var t=e.url;delete e.url,h.ajax.post(t,e,function(e,t,o){h.ajax.handleJSON(e)})}},post:function(e,t,o,n){var a,s;a=e.startsWith(window.location.protocol)?e:this.getAddr()+e,"function"==typeof o?(n=o,o={}):o||(o={}),void 0===n&&(n=o.callback),"string"==typeof n&&(n=h.getFunctionByName(n)),delete o.callback;var i={url:a,type:"post",cache:!1,async:"function"==typeof n,data:p.param(t),dataType:"json",beforeSend:function(e,t){if(void 0!==g.Cookies){var o=Cookies.get(h.csrfCookieName);o&&e.setRequestHeader(h.csrfHeaderName,o)}},success:n||function(e){s=e.result}},r=p.extend({},i,o);return p.ajax(r),s},getResponse:function(t){var o,n,e=t.getResponseHeader("content-type");if(e)if(e.startsWith("application/javascript"))o="script",n=t.responseText;else if(e.startsWith("text/html"))o="html",n=t.responseText;else if(e.startsWith("text/xml"))o="xml",n=t.responseText;else if(n=t.responseJSON)o="json";else try{n=JSON.parse(t.responseText),o="json"}catch(e){n=t.responseText,o="text"}else o="json",n={status:"alert",alert:{title:h.i18n.ERROR_OCCURED,content:h.i18n.NO_SERVER_RESPONSE}};return{contentType:o,data:n}},handleJSON:function(e,t,o){var n,a,s,i,r,l,c,f=e.status;switch(f){case"alert":g.alert&&g.alert(e.alert.title+"\n\n"+e.alert.content);break;case"error":h.form&&h.form.showErrors(t,e);break;case"info":case"success":void 0!==t&&(h.form&&h.form.resetChanged(t),!1!==e.close_form&&h.dialog&&h.dialog.close(t));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==t&&(h.form&&h.form.resetChanged(t),!1!==e.close_form&&h.dialog&&h.dialog.close(t));break;case"modal":h.dialog&&h.dialog.open(e.location);break;case"reload":void 0!==t&&(h.form&&h.form.resetChanged(t),!1!==e.close_form&&h.dialog&&h.dialog.close(t)),(n=e.location||window.location.hash).startsWith("#")&&(n=n.substr(1));var d=p(e.target||o||"#content");h.skin&&h.skin.loadURL(n,d,{preLoadCallback:h.getFunctionByName(e.pre_reload)||function(){p("[data-ams-pre-reload]",d).each(function(){h.executeFunctionByName(p(this).data("ams-pre-reload"))})},preLoadCallbackOptions:e.pre_reload_options,afterLoadCallback:h.getFunctionByName(e.post_reload)||function(){p("[data-ams-post-reload]",d).each(function(){h.executeFunctionByName(p(this).data("ams-post-reload"))})},afterLoadCallbackOptions:e.post_reload_options});break;case"redirect":void 0!==t&&(h.form&&h.form.resetChanged(t),!0===e.close_form&&h.dialog&&h.dialog.close(t)),(n=e.location||window.location.href).endsWith("##")&&(n=n.replace(/##/,window.location.hash)),e.window?window.open(n,e.window,e.options):window.location.href===n?window.location.reload(!0):window.location.href=n;break;default:console&&console.log&&console.log("Unhandled status: "+f)}if(e.content&&(s=e.content,i=p(s.target||o||t||"#content"),!0===s.raw?i.text(s.text):(i.html(s.html),h.initContent&&h.initContent(i)),s.keep_hidden||i.removeClass("hidden")),e.contents){var u=e.contents;for(a=0;a