PageSourceSearch

https://my.dundeecity.gov.uk/shared/js/api

js dundeecity.gov.uk collected 2026-09-24 09:00:53 UTC 12,374 bytes, 327 lines download raw bytes

1(function(){
2    (function(root, factory){
3      var _, dependencies;
4      _ = root._ || require('lodash');
5      dependencies = ['bluebird', 'oboe', 'lodash', 'jquery', './auth', './utils'];
6      if (typeof define === 'function' && define.amd) {
7        return define(dependencies, factory);
8      } else if (typeof exports === 'object') {
9        return module.exports = factory.apply(this, _.map(dependencies, require));
10      } else {
11        root.FS = root.FS || {};
12        return root.FS.API = factory(root.Promise, root.oboe, root._, root.jQuery, root.FS.Auth, root.utils);
13      }
14    })(this, function(Promise, oboe, _, $, Auth, utils){
15      var config, root, ref$, API;
16      if (!Promise) {
17        throw new Error('Bluebird.js is not available');
18      }
19      if (!oboe) {
20        throw new Error('oboe.js is not available');
21      }
22      if (!_) {
23        throw new Error('lodash.js is not available');
24      }
25      if (!$) {
26        throw new Error('jquery.js is not available');
27      }
28      if (!Auth) {
29        throw new Error('FS.Auth is not available');
30      }
31      if (!utils) {
32        throw new Error('utils is not available');
33      }
34      config = this.config || utils.defaultConfig;
35      root = this.window || this;
36      Auth = ((ref$ = root.FS) != null ? ref$.Auth : void 8) || Auth;
37      API = (function(){
38        API.displayName = 'API';
39        var prototype = API.prototype, constructor = API;
40        function API(overrideConfig){
41          var this$ = this instanceof ctor$ ? this : new ctor$;
42          this$.config = _.defaults(overrideConfig || {}, config);
43          this$.auth = Auth.withConfig(this$.config);
44          this$.appName = null;
45          this$.cacheObject = false;
46          _.each(['get', 'delete', 'post', 'put', 'patch', 'postform'], function(method){
47            return this$[method] = function(name, query, data, expect, newApi, options){
48              var transform, returner;
49              expect == null && (expect = 'json');
50              newApi == null && (newApi = false);
51              transform = method === 'postform'
52                ? $.param
53                : JSON.stringify;
54              returner = this.request(name, _.extend({
55                query: query || {},
56                method: method === 'postform' ? 'post' : method,
57                data: transform(data),
58                newApi: newApi
59              }, options), expect);
60              returner.then(function(response){
61                if (typeof response === 'undefined' || response === null || response.length === 0) {
62                  return false;
63                }
64              });
65              return returner;
66            };
67          }, this$);
68          return this$;
69        } function ctor$(){} ctor$.prototype = prototype;
70        prototype.toString = function(){
71          return 'FS.API';
72        };
73        prototype.setAppName = function(name){
74          return this.appName = name;
75        };
76        prototype.isMobileApp = function(){
77          return deepEq$(this.appName, 'AF-Renderer::Mobile', '===');
78        };
79        prototype.setCacheObject = function(cacheObject){
80          return this.cacheObject = cacheObject;
81        };
82        prototype.apiUrl = function(api, query){
83          var callAuth, useSlash, queryString, url, hasQuery;
84          if (!_.isString(api)) {
85            throw {
86              name: JSON.stringify(options, {
87                message: 'No API name supplied to FS.API.apiUrl'
88              })
89            };
90          }
91          callAuth = query != null ? query.auth : void 8;
92          useSlash = api.charAt(0) === '/';
93          queryString = _.isObject(query) ? utils.makeQueryString(query) : query;
94          if (!callAuth) {
95            url = [this.config.apiUrl];
96          } else {
97            url = ['/'];
98          }
99          if (useSlash && !config.vhostsWorkaround) {
100            url.push(this.config.apiUrl.slice(-1 === '/') ? api.slice(1) : api);
101          }
102          hasQuery = true;
103          if (!useSlash) {
104            url.push('?api=', api);
105          } else if (config.vhostsWorkaround) {
106            url.push('?path=', api.slice(1));
107          } else {
108            hasQuery = false;
109          }
110          if (queryString) {
111            url.push(hasQuery ? '&' : '?', queryString);
112            hasQuery = true;
113          }
114          if (this.appName) {
115            url.push(hasQuery ? '&' : '?', 'app_name=', this.appName);
116            hasQuery = true;
117          }
118          url.push(hasQuery ? '&' : '?', '_=', +new Date().getTime());
119          return url.join('');
120        };
121        prototype.newApiUrl = function(api, query){
122          var callAuth, useSlash, queryString, tempUrl, url, hasQuery;
123          callAuth = query != null ? query.auth : void 8;
124          useSlash = api.charAt(0) === '/';
125          queryString = _.isObject(query) ? utils.makeQueryString(query) : query;
126          tempUrl = this.config.apiUrl.replace(/(\/)?apibroker(\/)?$/, '') + '/api/';
127          if (!callAuth) {
128            url = [tempUrl];
129          } else {
130            url = ['/'];
131          }
132          if (useSlash && !config.vhostsWorkaround) {
133            url.push(url.slice(-1 === '/') ? api.slice(1) : api);
134          }
135          if (queryString) {
136            url.push(hasQuery ? '&' : '?', queryString);
137            hasQuery = true;
138          }
139          url.push(hasQuery ? '&' : '?', '_=', +new Date().getTime());
140          return url.join('');
141        };
142        prototype.request = function(api, options, expect){
143          var apiEndpointKey, url, method, cache, isJson, contentType, data, authKey, this$ = this;
144          options == null && (options = {});
145          expect == null && (expect = 'json');
146          apiEndpointKey = api;
147          if (deepEq$(apiEndpointKey.indexOf('/'), 0, '===')) {
148            apiEndpointKey = apiEndpointKey.substring(1);
149          }
150          apiEndpointKey = apiEndpointKey.replace(/^([A-Z])|[\s-_/](\w)/g, function(found, p1, p2, offset){
151            if (p2) {
152              return p2.toUpperCase();
153            }
154            return p1.toLowerCase();
155          });
156          if (options.method === 'get' && this.cacheObject && this.cacheObject.has(apiEndpointKey)) {
157            return this.cacheObject.get(apiEndpointKey);
158          }
159          if (options.newApi) {
160            url = this.newApiUrl(api, options.query);
161          } else {
162            url = this.apiUrl(api, options.query);
163          }
164          method = options.method || 'GET';
165          cache = !!(typeof options.cache === 'undefined' || options.cache);
166          isJson = expect === 'json';
167          if (options.contentType) {
168            contentType = options.contentType;
169          } else if (isJson) {
170            contentType = 'application/json';
171          } else {
172            contentType = 'application/x-www-form-urlencoded';
173          }
174          data = isJson && this.config.streamingEnabled
175            ? (contentType && (options.headers || (options.headers = {}), options.headers['Content-Type'] = contentType), {
176              url: url,
177              method: method,
178              headers: options.headers,
179              body: options.data,
180              cache: cache
181            })
182            : {
183              url: url,
184              type: method,
185              data: options.data,
186              dataType: expect,
187              headers: options.headers,
188              contentType: options.contentType,
189              cache: cache,
190              processData: !(contentType && contentType !== '')
191            };
192          authKey = typeof root.getItem === 'function' ? root.getItem('authKey') : void 8;
193          if (authKey) {
194            data.url += '&sid=' + authKey;
195            if (isJson && this.config.streamingEnabled) {
196              return this.oboeify(oboe(data));
197            } else {
198              return this.oboeify($.ajax(data));
199            }
200          } else {
201            return this.auth.hasSession().then(function(session){
202              data.url += '&sid=' + session['auth-session'];
203              if (isJson && this$.config.streamingEnabled) {
204                return this$.oboeify(oboe(data));
205              } else {
206                return this$.oboeify($.ajax(data));
207              }
208            });
209          }
210        };
211        prototype.withConfig = function(overrideConfig){
212          return new API(overrideConfig);
213        };
214        prototype.oboeify = function(func){
215          var oboe_promise;
216          oboe_promise = new Promise(function(resolve, reject){
217            return func.done(resolve).fail(reject);
218          }).cancellable()['catch'](function(err){
219            if (err.body !== '') {
220              throw err;
221            }
222          });
223          _.each(['node', 'path', 'on'], function(method){
224            return oboe_promise[method] = function(){
225              var args;
226              args = arguments;
227              oboe_promise.then(function(request){
228                if (!_.isFunction(request[method])) {
229                  throw new Error(method + " is not implemented for this API type.");
230                }
231                return request[method].apply(request, args);
232              });
233              return oboe_promise;
234            };
235          });
236          return oboe_promise;
237        };
238        return API;
239      }());
240      return new API();
241    });
242    function deepEq$(x, y, type){
243      var toString = {}.toString, hasOwnProperty = {}.hasOwnProperty,
244          has = function (obj, key) { return hasOwnProperty.call(obj, key); };
245      var first = true;
246      return eq(x, y, []);
247      function eq(a, b, stack) {
248        var className, length, size, result, alength, blength, r, key, ref, sizeB;
249        if (a == null || b == null) { return a === b; }
250        if (a.__placeholder__ || b.__placeholder__) { return true; }
251        if (a === b) { return a !== 0 || 1 / a == 1 / b; }
252        className = toString.call(a);
253        if (toString.call(b) != className) { return false; }
254        switch (className) {
255          case '[object String]': return a == String(b);
256          case '[object Number]':
257            return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
258          case '[object Date]':
259          case '[object Boolean]':
260            return +a == +b;
261          case '[object RegExp]':
262            return a.source == b.source &&
263                   a.global == b.global &&
264                   a.multiline == b.multiline &&
265                   a.ignoreCase == b.ignoreCase;
266        }
267        if (typeof a != 'object' || typeof b != 'object') { return false; }
268        length = stack.length;
269        while (length--) { if (stack[length] == a) { return true; } }
270        stack.push(a);
271        size = 0;
272        result = true;
273        if (className == '[object Array]') {
274          alength = a.length;
275          blength = b.length;
276          if (first) { 
277            switch (type) {
278            case '===': result = alength === blength; break;
279            case '<==': result = alength <= blength; break;
280            case '<<=': result = alength < blength; break;
281            }
282            size = alength;
283            first = false;
284          } else {
285            result = alength === blength;
286            size = alength;
287          }
288          if (result) {
289            while (size--) {
290              if (!(result = size in a == size in b && eq(a[size], b[size], stack))){ break; }
291            }
292          }
293        } else {
294          if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) {
295            return false;
296          }
297          for (key in a) {
298            if (has(a, key)) {
299              size++;
300              if (!(result = has(b, key) && eq(a[key], b[key], stack))) { break; }
301            }
302          }
303          if (result) {
304            sizeB = 0;
305            for (key in b) {
306              if (has(b, key)) { ++sizeB; }
307            }
308            if (first) {
309              if (type === '<<=') {
310                result = size < sizeB;
311              } else if (type === '<==') {
312                result = size <= sizeB
313              } else {
314                result = size === sizeB;
315              }
316            } else {
317              first = false;
318              result = size === sizeB;
319            }
320          }
321        }
322        stack.pop();
323        return result;
324      }
325    }
326  }).call(this);
327  

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.