PageSourceSearch

https://e-control.org/2.0/api.js

js e-control.org collected 2026-10-06 05:05:37 UTC 5,009 bytes, 3 lines download raw bytes

1/*! licenses: /build/vendor_theme.LICENSE.txt */
2(function(){"use strict";(function(){var p=angular.module("ct.services.api",[]);p.value("CTServiceAPIConfig",{HOST:"",API_VERSION:"v1"}),p.service("CTServiceAPI",["$http","$q","$log","$httpParamSerializer","CTServiceAPIConfig",function(v,R,I,g,s){var S="undefined",a={},u,T={create:function(e,t,r){var n="";if(r){var o=new Date;o.setTime(o.getTime()+r*60*60*1e3),n="; expires="+o.toGMTString()}document.cookie=e+"="+t+n+"; path=/"},read:function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(t)==0)return o.substring(t.length,o.length)}return!1}},c=(function(){var e={};return{notify:function(t){var r=Array.prototype.slice.call(arguments,1);e[t]&&e[t].map(function(n){n.apply(void 0,r)})},subscribe:function(t,r){e[t]||(e[t]=[]),e[t].indexOf(r)===-1&&e[t].push(r)},unsubscribe:function(t,r){if(e[t]){var n=e[t].indexOf(r);n!==-1&&e[t].splice(n,1)}}}})(),d,l={},h=0;return window.Worker&&s.workerURL?(d=new Worker(s.workerURL),d.onmessage=function(e){var t=l[e.data.id].config,r=l[e.data.id].defer;e.data.status>=200&&e.data.status<400&&(typeof e.data.response.error>"u"||e.data.response.error===!1)?a.finishedRequest(t,e.data.response,e.data.status,r,!1):a.finishedRequest(t,e.data.response,e.data.status,r,!0)},d.onerror=function(e){var t=l[e.data.id].config,r=l[e.data.id].defer;a.finishedRequest(t,e.data.response,e.data.status,r,!0)}):(console.group("CTServiceAPI"),I.warn("CTServiceAPI would use WebWorkers. But WorkerAPI is not available!"),console.debug(window.Worker,s.workerURL),console.groupEnd("CTServiceAPI")),a.authenticationData=function(){return{USER_IDENTIFIER:T.read("USER_IDENTIFIER")}},a.setupRequest=function(e){return e.params=e.params||{},e.headers=e.headers||{},document.querySelector('meta[name="csrf-token"]')?(e.headers["X-CSRF-TOKEN"]=document.querySelector('meta[name="csrf-token"]').getAttribute("content"),e.headers["X-XSRF-TOKEN"]=document.querySelector('meta[name="csrf-token"]').getAttribute("content")):console.error("no csrf token was found on the page"),e.headers["X-Requested-With"]="XMLHttpRequest",e.url=s.HOST.replace(/http(s?):/,"")+(s.API_VERSION?"/api/"+s.API_VERSION:"")+e.url,c.notify("transform",e),a.runRequest(e)},a.runRequest=function(e){var t=R.defer(),r=e.url.split("/").slice(-2).filter(function(n){return!/[a-f0-9]{32}/i.test(n)}).join("/");if(console.groupCollapsed("API CALL: %o",r),console.debug("Method: %o",e.method),console.debug("URL: %o",e.url),console.debug("Params: %o",e.params),console.debug("POST Data: %o",e.data),console.info("--- checking params ---"),(function n(o,f){f=typeof f===S?"":f,angular.forEach(o,function(i,m){angular.isArray(i)||angular.isObject(i)?i.constructor&&i.constructor.name&&i.constructor.name.substr(0,2).toLowerCase()=="ct"?console.warn("Can't use object of type %o as POST-Data!",i.constructor.name):n(i,f+"."+m):console.info("%o => %o     | \u2714 ok",f+"."+m,i)})})(e.data),!d||e.useWorker===!1)typeof e.useWorker<"u"&&delete e.useWorker,console.time("API TIME :: `"+r+"`"),v(e).success(function(n,o){console.timeEnd("API TIME :: `"+r+"`"),a.finishedRequest(e,n,o,t,!1)}).error(function(n,o){console.timeEnd("API TIME :: `"+r+"`"),a.finishedRequest(e,n,o,t,!0)});else{e.url=(function(n,o){return o.length>0&&(n+=(n.indexOf("?")==-1?"?":"&")+o),n})(e.url,g(e.params||{}));try{d.postMessage({id:++h,method:e.method,url:e.url,data:e.data,headers:e.headers})}catch(n){console.warn(n),t.reject(n)}l[h]={defer:t,config:e}}return console.groupEnd("API CALL: %o",r),t.promise},a.finishedRequest=function(e,t,r,n,o){o?(c.notify("reject",t||{}),n.reject(t||{})):(c.notify("resolve",t),n.resolve(t))},u=function(e){return e=angular.copy(e),a.setupRequest(e)},u.url=function(e){return s.HOST.replace(/http(s?):/,"")+(s.API_VERSION?"/api/"+s.API_VERSION+"/":"/")+e},u.signedURL=function(e,t){return(function(r,n){return n.length>0&&(r+=(r.indexOf("?")==-1?"?":"&")+n),r})(e,g(angular.extend({},t)))},u.authenticationData=a.authenticationData,u.get=function(e,t){var r=angular.extend({},{params:t});return r.method="GET",r.url=e,a.setupRequest(r)},u.post=function(e,t,r){var n=angular.extend({},r);return n.method="POST",n.url=e,n.data=t,a.setupRequest(n)},u.put=function(e,t,r){var n=angular.extend({},r);return n.method="PUT",n.url=e,n.data=t,a.setupRequest(n)},u.delete=function(e,t){var r=angular.extend({},t);return r.method="DELETE",r.url=e,a.setupRequest(r)},u.jsonp=function(e,t){var r=angular.extend({},t,{useWorker:!1});return r.method="JSONP",r.url=e,a.setupRequest(r)},u.patch=function(e,t,r){var n=angular.extend({},r);return n.method="PATCH",n.url=e,n.data=t,a.setupRequest(n)},u.upload=function(e,t){var r=new FormData;return r.append("file",e),t=t||"/uploaded_images",u.post(t,r,{useWorker:!1,transformRequest:angular.identity,headers:{"Content-Type":void 0}})},u.channel={subscribe:c.subscribe,unsubscribe:c.unsubscribe},u}])})()})();
3//# sourceMappingURL=api.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.