Files
sysPass/js/app-requests.min.js
nuxsmin 3979d28e2d * [DEV] Improved account search handling
* [DEV] Fixed some UI issues
2016-11-02 03:26:21 +01:00

8 lines
2.6 KiB
JavaScript

var $jscomp={scope:{},checkStringArgs:function(b,c,a){if(null==b)throw new TypeError("The 'this' value for String.prototype."+a+" must not be null or undefined");if(c instanceof RegExp)throw new TypeError("First argument to String.prototype."+a+" must not be a regular expression");return b+""}};
$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,c,a){if(a.get||a.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[c]=a.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(b,c,a,d){if(c){a=$jscomp.global;b=b.split(".");for(d=0;d<b.length-1;d++){var e=b[d];e in a||(a[e]={});a=a[e]}b=b[b.length-1];d=a[b];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(a,b,{configurable:!0,writable:!0,value:c})}};
$jscomp.polyfill("String.prototype.startsWith",function(b){return b?b:function(b,a){var c=$jscomp.checkStringArgs(this,b,"startsWith");b+="";for(var e=c.length,f=b.length,g=Math.max(0,Math.min(a|0,c.length)),h=0;h<f&&g<e;)if(c[g++]!=b[h++])return!1;return h>=f}},"es6-impl","es3");
sysPass.Requests=function(b){var c=b.log,a=[],d={get:function(){return a},add:function(b){var e=""===b.hash?SparkMD5.hash(JSON.stringify(b),!1):b.hash;if(0<a.length&&a[a.length-1].hash===e)return a;c.info("history:add");b.hash=e;a.push(b);15<=a.length&&a.splice(0,10);return a},del:function(){c.info("history:del");if("undefined"!==typeof a.pop())return a[a.length-1]},reset:function(){c.info("history:reset");a=[]},length:function(){return a.length}};return{getRequestOpts:function(){return Object.create({type:"json",
url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0})},getActionCall:function(a,f,g){c.info("getActionCall");var e=a.url.startsWith("http",0)?a.url:b.config().APP_ROOT+a.url;return $.ajax({dataType:a.type,url:e,method:a.method,async:a.async,data:a.data,cache:a.cache,processData:a.processData,contentType:a.contentType,timeout:a.timeout,beforeSend:function(){!0===a.useLoading&&
b.appTheme().loading.show()},success:function(b){if("function"!==typeof f)return!0;!0===a.addHistory&&(a.callback=f,d.add(a));f(b)},error:function(d,e,f){"function"!==typeof g?(d=b.config().LANG[1]+"<p>"+f+e+"</p>",c.error(d),"html"===a.type&&$("#content").html(b.msg.html.error(f)),b.msg.error(d)):g()},complete:function(){!0===a.useLoading&&b.appTheme().loading.hide();b.appTheme().ajax.complete()}})},history:d}};