PageSourceSearch

https://framaforms.org/sites/default/files/js/js_eO1xGpWsx23dSO88TM6qtWtG2hH5uC044WprtKeCl8A.js

js framaforms.org collected 2026-10-01 08:35:14 UTC 2,901 bytes, 120 lines download raw bytes

1// Generated by CoffeeScript 1.9.3
2var $, EndpointRegistry, PollingEndpoint;
3
4$ = jQuery;
5
6PollingEndpoint = (function() {
7  function PollingEndpoint(settings) {
8    var defaults;
9    defaults = {
10      url: '',
11      interval: 5000,
12      intervalMultiplier: 1.07,
13      maxErrorCount: 15
14    };
15    this.settings = $.extend({}, defaults, settings);
16    this.interval = this.settings.interval;
17    this.errorCount = 0;
18    this.callbacks = {};
19    this.stopped = false;
20  }
21
22  PollingEndpoint.prototype.scheduleNextPoll = function() {
23    return setTimeout((function(_this) {
24      return function() {
25        _this.poll();
26        if (!_this.stopped) {
27          _this.interval = Math.floor(_this.interval * _this.settings.intervalMultiplier);
28          return _this.scheduleNextPoll();
29        }
30      };
31    })(this), this.interval);
32  };
33
34  PollingEndpoint.prototype.poll = function() {
35    if (this.stopped) {
36      return;
37    }
38    return jQuery.ajax({
39      url: this.settings.url,
40      success: (function(_this) {
41        return function(data) {
42          var _, callback, ref;
43          ref = _this.callbacks;
44          for (_ in ref) {
45            callback = ref[_];
46            callback(data);
47          }
48        };
49      })(this),
50      error: (function(_this) {
51        return function(data) {
52          if (data.status === '403') {
53            _this.stopped = true;
54          } else if (data.status === '404') {
55            _this.stopped = true;
56          } else if (_this.errorCount >= _this.settings.maxErrorCount) {
57            _this.stopped = true;
58          } else {
59            _this.errorCount += 1;
60          }
61        };
62      })(this)
63    });
64  };
65
66  PollingEndpoint.prototype.addCallback = function(key, callback) {
67    this.callbacks[key] = callback;
68    return this;
69  };
70
71  return PollingEndpoint;
72
73})();
74
75EndpointRegistry = (function() {
76  function EndpointRegistry() {
77    this.registry = {};
78  }
79
80  EndpointRegistry.prototype.registerUrl = function(url, key, callback) {
81    if (!this.registry[url]) {
82      this.registry[url] = new PollingEndpoint({
83        url: url
84      });
85    }
86    return this.registry[url].addCallback(key, callback);
87  };
88
89  EndpointRegistry.prototype.start = function() {
90    var endpoint, ref, url;
91    ref = this.registry;
92    for (url in ref) {
93      endpoint = ref[url];
94      endpoint.scheduleNextPoll();
95    }
96  };
97
98  return EndpointRegistry;
99
100})();
101
102Drupal.behaviors.polling = {
103  registry: new EndpointRegistry(),
104  attach: function(context, settings) {
105    var defaults, start;
106    if ($('html', context).length) {
107      defaults = {
108        initialTimeout: 500
109      };
110      settings = $.extend({}, defaults, settings.polling);
111      start = (function(_this) {
112        return function() {
113          return _this.registry.start();
114        };
115      })(this);
116      return setTimeout(start, settings.initialTimeout);
117    }
118  }
119};
120;

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.