good_job 3.12.4 → 3.12.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -9
- data/app/assets/good_job/{modules/application.js → application.js} +4 -0
- data/app/assets/good_job/vendor/chartjs/chart.min.js +15 -9
- data/app/assets/good_job/vendor/rails_ujs.js +7 -747
- data/app/assets/good_job/vendor/stimulus.js +2408 -0
- data/app/controllers/good_job/assets_controller.rb +25 -27
- data/app/views/good_job/shared/_filter.erb +3 -3
- data/app/views/good_job/shared/_navbar.erb +2 -2
- data/app/views/layouts/good_job/application.html.erb +8 -8
- data/config/locales/en.yml +3 -4
- data/config/locales/es.yml +3 -4
- data/config/locales/fr.yml +3 -4
- data/config/locales/nl.yml +3 -4
- data/config/locales/ru.yml +3 -4
- data/config/locales/ua.yml +3 -4
- data/config/routes.rb +2 -12
- data/lib/good_job/adapter.rb +9 -22
- data/lib/good_job/capsule.rb +83 -0
- data/lib/good_job/cli.rb +4 -10
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +11 -14
- metadata +9 -7
@@ -1,747 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
(function() {
|
9
|
-
var context = this;
|
10
|
-
|
11
|
-
(function() {
|
12
|
-
(function() {
|
13
|
-
this.Rails = {
|
14
|
-
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
|
15
|
-
buttonClickSelector: {
|
16
|
-
selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',
|
17
|
-
exclude: 'form button'
|
18
|
-
},
|
19
|
-
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
|
20
|
-
formSubmitSelector: 'form:not([data-turbo=true])',
|
21
|
-
formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
|
22
|
-
formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
|
23
|
-
formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
|
24
|
-
fileInputSelector: 'input[name][type=file]:not([disabled])',
|
25
|
-
linkDisableSelector: 'a[data-disable-with], a[data-disable]',
|
26
|
-
buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'
|
27
|
-
};
|
28
|
-
|
29
|
-
}).call(this);
|
30
|
-
}).call(context);
|
31
|
-
|
32
|
-
var Rails = context.Rails;
|
33
|
-
|
34
|
-
(function() {
|
35
|
-
(function() {
|
36
|
-
var nonce;
|
37
|
-
|
38
|
-
nonce = null;
|
39
|
-
|
40
|
-
Rails.loadCSPNonce = function() {
|
41
|
-
var ref;
|
42
|
-
return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
|
43
|
-
};
|
44
|
-
|
45
|
-
Rails.cspNonce = function() {
|
46
|
-
return nonce != null ? nonce : Rails.loadCSPNonce();
|
47
|
-
};
|
48
|
-
|
49
|
-
}).call(this);
|
50
|
-
(function() {
|
51
|
-
var expando, m;
|
52
|
-
|
53
|
-
m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
|
54
|
-
|
55
|
-
Rails.matches = function(element, selector) {
|
56
|
-
if (selector.exclude != null) {
|
57
|
-
return m.call(element, selector.selector) && !m.call(element, selector.exclude);
|
58
|
-
} else {
|
59
|
-
return m.call(element, selector);
|
60
|
-
}
|
61
|
-
};
|
62
|
-
|
63
|
-
expando = '_ujsData';
|
64
|
-
|
65
|
-
Rails.getData = function(element, key) {
|
66
|
-
var ref;
|
67
|
-
return (ref = element[expando]) != null ? ref[key] : void 0;
|
68
|
-
};
|
69
|
-
|
70
|
-
Rails.setData = function(element, key, value) {
|
71
|
-
if (element[expando] == null) {
|
72
|
-
element[expando] = {};
|
73
|
-
}
|
74
|
-
return element[expando][key] = value;
|
75
|
-
};
|
76
|
-
|
77
|
-
Rails.$ = function(selector) {
|
78
|
-
return Array.prototype.slice.call(document.querySelectorAll(selector));
|
79
|
-
};
|
80
|
-
|
81
|
-
}).call(this);
|
82
|
-
(function() {
|
83
|
-
var $, csrfParam, csrfToken;
|
84
|
-
|
85
|
-
$ = Rails.$;
|
86
|
-
|
87
|
-
csrfToken = Rails.csrfToken = function() {
|
88
|
-
var meta;
|
89
|
-
meta = document.querySelector('meta[name=csrf-token]');
|
90
|
-
return meta && meta.content;
|
91
|
-
};
|
92
|
-
|
93
|
-
csrfParam = Rails.csrfParam = function() {
|
94
|
-
var meta;
|
95
|
-
meta = document.querySelector('meta[name=csrf-param]');
|
96
|
-
return meta && meta.content;
|
97
|
-
};
|
98
|
-
|
99
|
-
Rails.CSRFProtection = function(xhr) {
|
100
|
-
var token;
|
101
|
-
token = csrfToken();
|
102
|
-
if (token != null) {
|
103
|
-
return xhr.setRequestHeader('X-CSRF-Token', token);
|
104
|
-
}
|
105
|
-
};
|
106
|
-
|
107
|
-
Rails.refreshCSRFTokens = function() {
|
108
|
-
var param, token;
|
109
|
-
token = csrfToken();
|
110
|
-
param = csrfParam();
|
111
|
-
if ((token != null) && (param != null)) {
|
112
|
-
return $('form input[name="' + param + '"]').forEach(function(input) {
|
113
|
-
return input.value = token;
|
114
|
-
});
|
115
|
-
}
|
116
|
-
};
|
117
|
-
|
118
|
-
}).call(this);
|
119
|
-
(function() {
|
120
|
-
var CustomEvent, fire, matches, preventDefault;
|
121
|
-
|
122
|
-
matches = Rails.matches;
|
123
|
-
|
124
|
-
CustomEvent = window.CustomEvent;
|
125
|
-
|
126
|
-
if (typeof CustomEvent !== 'function') {
|
127
|
-
CustomEvent = function(event, params) {
|
128
|
-
var evt;
|
129
|
-
evt = document.createEvent('CustomEvent');
|
130
|
-
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
131
|
-
return evt;
|
132
|
-
};
|
133
|
-
CustomEvent.prototype = window.Event.prototype;
|
134
|
-
preventDefault = CustomEvent.prototype.preventDefault;
|
135
|
-
CustomEvent.prototype.preventDefault = function() {
|
136
|
-
var result;
|
137
|
-
result = preventDefault.call(this);
|
138
|
-
if (this.cancelable && !this.defaultPrevented) {
|
139
|
-
Object.defineProperty(this, 'defaultPrevented', {
|
140
|
-
get: function() {
|
141
|
-
return true;
|
142
|
-
}
|
143
|
-
});
|
144
|
-
}
|
145
|
-
return result;
|
146
|
-
};
|
147
|
-
}
|
148
|
-
|
149
|
-
fire = Rails.fire = function(obj, name, data) {
|
150
|
-
var event;
|
151
|
-
event = new CustomEvent(name, {
|
152
|
-
bubbles: true,
|
153
|
-
cancelable: true,
|
154
|
-
detail: data
|
155
|
-
});
|
156
|
-
obj.dispatchEvent(event);
|
157
|
-
return !event.defaultPrevented;
|
158
|
-
};
|
159
|
-
|
160
|
-
Rails.stopEverything = function(e) {
|
161
|
-
fire(e.target, 'ujs:everythingStopped');
|
162
|
-
e.preventDefault();
|
163
|
-
e.stopPropagation();
|
164
|
-
return e.stopImmediatePropagation();
|
165
|
-
};
|
166
|
-
|
167
|
-
Rails.delegate = function(element, selector, eventType, handler) {
|
168
|
-
return element.addEventListener(eventType, function(e) {
|
169
|
-
var target;
|
170
|
-
target = e.target;
|
171
|
-
while (!(!(target instanceof Element) || matches(target, selector))) {
|
172
|
-
target = target.parentNode;
|
173
|
-
}
|
174
|
-
if (target instanceof Element && handler.call(target, e) === false) {
|
175
|
-
e.preventDefault();
|
176
|
-
return e.stopPropagation();
|
177
|
-
}
|
178
|
-
});
|
179
|
-
};
|
180
|
-
|
181
|
-
}).call(this);
|
182
|
-
(function() {
|
183
|
-
var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
|
184
|
-
|
185
|
-
cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
|
186
|
-
|
187
|
-
AcceptHeaders = {
|
188
|
-
'*': '*/*',
|
189
|
-
text: 'text/plain',
|
190
|
-
html: 'text/html',
|
191
|
-
xml: 'application/xml, text/xml',
|
192
|
-
json: 'application/json, text/javascript',
|
193
|
-
script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'
|
194
|
-
};
|
195
|
-
|
196
|
-
Rails.ajax = function(options) {
|
197
|
-
var xhr;
|
198
|
-
options = prepareOptions(options);
|
199
|
-
xhr = createXHR(options, function() {
|
200
|
-
var ref, response;
|
201
|
-
response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));
|
202
|
-
if (Math.floor(xhr.status / 100) === 2) {
|
203
|
-
if (typeof options.success === "function") {
|
204
|
-
options.success(response, xhr.statusText, xhr);
|
205
|
-
}
|
206
|
-
} else {
|
207
|
-
if (typeof options.error === "function") {
|
208
|
-
options.error(response, xhr.statusText, xhr);
|
209
|
-
}
|
210
|
-
}
|
211
|
-
return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
|
212
|
-
});
|
213
|
-
if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {
|
214
|
-
return false;
|
215
|
-
}
|
216
|
-
if (xhr.readyState === XMLHttpRequest.OPENED) {
|
217
|
-
return xhr.send(options.data);
|
218
|
-
}
|
219
|
-
};
|
220
|
-
|
221
|
-
prepareOptions = function(options) {
|
222
|
-
options.url = options.url || location.href;
|
223
|
-
options.type = options.type.toUpperCase();
|
224
|
-
if (options.type === 'GET' && options.data) {
|
225
|
-
if (options.url.indexOf('?') < 0) {
|
226
|
-
options.url += '?' + options.data;
|
227
|
-
} else {
|
228
|
-
options.url += '&' + options.data;
|
229
|
-
}
|
230
|
-
}
|
231
|
-
if (AcceptHeaders[options.dataType] == null) {
|
232
|
-
options.dataType = '*';
|
233
|
-
}
|
234
|
-
options.accept = AcceptHeaders[options.dataType];
|
235
|
-
if (options.dataType !== '*') {
|
236
|
-
options.accept += ', */*; q=0.01';
|
237
|
-
}
|
238
|
-
return options;
|
239
|
-
};
|
240
|
-
|
241
|
-
createXHR = function(options, done) {
|
242
|
-
var xhr;
|
243
|
-
xhr = new XMLHttpRequest();
|
244
|
-
xhr.open(options.type, options.url, true);
|
245
|
-
xhr.setRequestHeader('Accept', options.accept);
|
246
|
-
if (typeof options.data === 'string') {
|
247
|
-
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
248
|
-
}
|
249
|
-
if (!options.crossDomain) {
|
250
|
-
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
251
|
-
CSRFProtection(xhr);
|
252
|
-
}
|
253
|
-
xhr.withCredentials = !!options.withCredentials;
|
254
|
-
xhr.onreadystatechange = function() {
|
255
|
-
if (xhr.readyState === XMLHttpRequest.DONE) {
|
256
|
-
return done(xhr);
|
257
|
-
}
|
258
|
-
};
|
259
|
-
return xhr;
|
260
|
-
};
|
261
|
-
|
262
|
-
processResponse = function(response, type) {
|
263
|
-
var parser, script;
|
264
|
-
if (typeof response === 'string' && typeof type === 'string') {
|
265
|
-
if (type.match(/\bjson\b/)) {
|
266
|
-
try {
|
267
|
-
response = JSON.parse(response);
|
268
|
-
} catch (error) {}
|
269
|
-
} else if (type.match(/\b(?:java|ecma)script\b/)) {
|
270
|
-
script = document.createElement('script');
|
271
|
-
script.setAttribute('nonce', cspNonce());
|
272
|
-
script.text = response;
|
273
|
-
document.head.appendChild(script).parentNode.removeChild(script);
|
274
|
-
} else if (type.match(/\b(xml|html|svg)\b/)) {
|
275
|
-
parser = new DOMParser();
|
276
|
-
type = type.replace(/;.+/, '');
|
277
|
-
try {
|
278
|
-
response = parser.parseFromString(response, type);
|
279
|
-
} catch (error) {}
|
280
|
-
}
|
281
|
-
}
|
282
|
-
return response;
|
283
|
-
};
|
284
|
-
|
285
|
-
Rails.href = function(element) {
|
286
|
-
return element.href;
|
287
|
-
};
|
288
|
-
|
289
|
-
Rails.isCrossDomain = function(url) {
|
290
|
-
var e, originAnchor, urlAnchor;
|
291
|
-
originAnchor = document.createElement('a');
|
292
|
-
originAnchor.href = location.href;
|
293
|
-
urlAnchor = document.createElement('a');
|
294
|
-
try {
|
295
|
-
urlAnchor.href = url;
|
296
|
-
return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
|
297
|
-
} catch (error) {
|
298
|
-
e = error;
|
299
|
-
return true;
|
300
|
-
}
|
301
|
-
};
|
302
|
-
|
303
|
-
}).call(this);
|
304
|
-
(function() {
|
305
|
-
var matches, toArray;
|
306
|
-
|
307
|
-
matches = Rails.matches;
|
308
|
-
|
309
|
-
toArray = function(e) {
|
310
|
-
return Array.prototype.slice.call(e);
|
311
|
-
};
|
312
|
-
|
313
|
-
Rails.serializeElement = function(element, additionalParam) {
|
314
|
-
var inputs, params;
|
315
|
-
inputs = [element];
|
316
|
-
if (matches(element, 'form')) {
|
317
|
-
inputs = toArray(element.elements);
|
318
|
-
}
|
319
|
-
params = [];
|
320
|
-
inputs.forEach(function(input) {
|
321
|
-
if (!input.name || input.disabled) {
|
322
|
-
return;
|
323
|
-
}
|
324
|
-
if (matches(input, 'fieldset[disabled] *')) {
|
325
|
-
return;
|
326
|
-
}
|
327
|
-
if (matches(input, 'select')) {
|
328
|
-
return toArray(input.options).forEach(function(option) {
|
329
|
-
if (option.selected) {
|
330
|
-
return params.push({
|
331
|
-
name: input.name,
|
332
|
-
value: option.value
|
333
|
-
});
|
334
|
-
}
|
335
|
-
});
|
336
|
-
} else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {
|
337
|
-
return params.push({
|
338
|
-
name: input.name,
|
339
|
-
value: input.value
|
340
|
-
});
|
341
|
-
}
|
342
|
-
});
|
343
|
-
if (additionalParam) {
|
344
|
-
params.push(additionalParam);
|
345
|
-
}
|
346
|
-
return params.map(function(param) {
|
347
|
-
if (param.name != null) {
|
348
|
-
return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
|
349
|
-
} else {
|
350
|
-
return param;
|
351
|
-
}
|
352
|
-
}).join('&');
|
353
|
-
};
|
354
|
-
|
355
|
-
Rails.formElements = function(form, selector) {
|
356
|
-
if (matches(form, 'form')) {
|
357
|
-
return toArray(form.elements).filter(function(el) {
|
358
|
-
return matches(el, selector);
|
359
|
-
});
|
360
|
-
} else {
|
361
|
-
return toArray(form.querySelectorAll(selector));
|
362
|
-
}
|
363
|
-
};
|
364
|
-
|
365
|
-
}).call(this);
|
366
|
-
(function() {
|
367
|
-
var allowAction, fire, stopEverything;
|
368
|
-
|
369
|
-
fire = Rails.fire, stopEverything = Rails.stopEverything;
|
370
|
-
|
371
|
-
Rails.handleConfirm = function(e) {
|
372
|
-
if (!allowAction(this)) {
|
373
|
-
return stopEverything(e);
|
374
|
-
}
|
375
|
-
};
|
376
|
-
|
377
|
-
Rails.confirm = function(message, element) {
|
378
|
-
return confirm(message);
|
379
|
-
};
|
380
|
-
|
381
|
-
allowAction = function(element) {
|
382
|
-
var answer, callback, message;
|
383
|
-
message = element.getAttribute('data-confirm');
|
384
|
-
if (!message) {
|
385
|
-
return true;
|
386
|
-
}
|
387
|
-
answer = false;
|
388
|
-
if (fire(element, 'confirm')) {
|
389
|
-
try {
|
390
|
-
answer = Rails.confirm(message, element);
|
391
|
-
} catch (error) {}
|
392
|
-
callback = fire(element, 'confirm:complete', [answer]);
|
393
|
-
}
|
394
|
-
return answer && callback;
|
395
|
-
};
|
396
|
-
|
397
|
-
}).call(this);
|
398
|
-
(function() {
|
399
|
-
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;
|
400
|
-
|
401
|
-
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
|
402
|
-
|
403
|
-
Rails.handleDisabledElement = function(e) {
|
404
|
-
var element;
|
405
|
-
element = this;
|
406
|
-
if (element.disabled) {
|
407
|
-
return stopEverything(e);
|
408
|
-
}
|
409
|
-
};
|
410
|
-
|
411
|
-
Rails.enableElement = function(e) {
|
412
|
-
var element;
|
413
|
-
if (e instanceof Event) {
|
414
|
-
if (isXhrRedirect(e)) {
|
415
|
-
return;
|
416
|
-
}
|
417
|
-
element = e.target;
|
418
|
-
} else {
|
419
|
-
element = e;
|
420
|
-
}
|
421
|
-
if (matches(element, Rails.linkDisableSelector)) {
|
422
|
-
return enableLinkElement(element);
|
423
|
-
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
|
424
|
-
return enableFormElement(element);
|
425
|
-
} else if (matches(element, Rails.formSubmitSelector)) {
|
426
|
-
return enableFormElements(element);
|
427
|
-
}
|
428
|
-
};
|
429
|
-
|
430
|
-
Rails.disableElement = function(e) {
|
431
|
-
var element;
|
432
|
-
element = e instanceof Event ? e.target : e;
|
433
|
-
if (matches(element, Rails.linkDisableSelector)) {
|
434
|
-
return disableLinkElement(element);
|
435
|
-
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
|
436
|
-
return disableFormElement(element);
|
437
|
-
} else if (matches(element, Rails.formSubmitSelector)) {
|
438
|
-
return disableFormElements(element);
|
439
|
-
}
|
440
|
-
};
|
441
|
-
|
442
|
-
disableLinkElement = function(element) {
|
443
|
-
var replacement;
|
444
|
-
if (getData(element, 'ujs:disabled')) {
|
445
|
-
return;
|
446
|
-
}
|
447
|
-
replacement = element.getAttribute('data-disable-with');
|
448
|
-
if (replacement != null) {
|
449
|
-
setData(element, 'ujs:enable-with', element.innerHTML);
|
450
|
-
element.innerHTML = replacement;
|
451
|
-
}
|
452
|
-
element.addEventListener('click', stopEverything);
|
453
|
-
return setData(element, 'ujs:disabled', true);
|
454
|
-
};
|
455
|
-
|
456
|
-
enableLinkElement = function(element) {
|
457
|
-
var originalText;
|
458
|
-
originalText = getData(element, 'ujs:enable-with');
|
459
|
-
if (originalText != null) {
|
460
|
-
element.innerHTML = originalText;
|
461
|
-
setData(element, 'ujs:enable-with', null);
|
462
|
-
}
|
463
|
-
element.removeEventListener('click', stopEverything);
|
464
|
-
return setData(element, 'ujs:disabled', null);
|
465
|
-
};
|
466
|
-
|
467
|
-
disableFormElements = function(form) {
|
468
|
-
return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
|
469
|
-
};
|
470
|
-
|
471
|
-
disableFormElement = function(element) {
|
472
|
-
var replacement;
|
473
|
-
if (getData(element, 'ujs:disabled')) {
|
474
|
-
return;
|
475
|
-
}
|
476
|
-
replacement = element.getAttribute('data-disable-with');
|
477
|
-
if (replacement != null) {
|
478
|
-
if (matches(element, 'button')) {
|
479
|
-
setData(element, 'ujs:enable-with', element.innerHTML);
|
480
|
-
element.innerHTML = replacement;
|
481
|
-
} else {
|
482
|
-
setData(element, 'ujs:enable-with', element.value);
|
483
|
-
element.value = replacement;
|
484
|
-
}
|
485
|
-
}
|
486
|
-
element.disabled = true;
|
487
|
-
return setData(element, 'ujs:disabled', true);
|
488
|
-
};
|
489
|
-
|
490
|
-
enableFormElements = function(form) {
|
491
|
-
return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
|
492
|
-
};
|
493
|
-
|
494
|
-
enableFormElement = function(element) {
|
495
|
-
var originalText;
|
496
|
-
originalText = getData(element, 'ujs:enable-with');
|
497
|
-
if (originalText != null) {
|
498
|
-
if (matches(element, 'button')) {
|
499
|
-
element.innerHTML = originalText;
|
500
|
-
} else {
|
501
|
-
element.value = originalText;
|
502
|
-
}
|
503
|
-
setData(element, 'ujs:enable-with', null);
|
504
|
-
}
|
505
|
-
element.disabled = false;
|
506
|
-
return setData(element, 'ujs:disabled', null);
|
507
|
-
};
|
508
|
-
|
509
|
-
isXhrRedirect = function(event) {
|
510
|
-
var ref, xhr;
|
511
|
-
xhr = (ref = event.detail) != null ? ref[0] : void 0;
|
512
|
-
return (xhr != null ? xhr.getResponseHeader("X-Xhr-Redirect") : void 0) != null;
|
513
|
-
};
|
514
|
-
|
515
|
-
}).call(this);
|
516
|
-
(function() {
|
517
|
-
var stopEverything;
|
518
|
-
|
519
|
-
stopEverything = Rails.stopEverything;
|
520
|
-
|
521
|
-
Rails.handleMethod = function(e) {
|
522
|
-
var csrfParam, csrfToken, form, formContent, href, link, method;
|
523
|
-
link = this;
|
524
|
-
method = link.getAttribute('data-method');
|
525
|
-
if (!method) {
|
526
|
-
return;
|
527
|
-
}
|
528
|
-
href = Rails.href(link);
|
529
|
-
csrfToken = Rails.csrfToken();
|
530
|
-
csrfParam = Rails.csrfParam();
|
531
|
-
form = document.createElement('form');
|
532
|
-
formContent = "<input name='_method' value='" + method + "' type='hidden' />";
|
533
|
-
if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
|
534
|
-
formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
|
535
|
-
}
|
536
|
-
formContent += '<input type="submit" />';
|
537
|
-
form.method = 'post';
|
538
|
-
form.action = href;
|
539
|
-
form.target = link.target;
|
540
|
-
form.innerHTML = formContent;
|
541
|
-
form.style.display = 'none';
|
542
|
-
document.body.appendChild(form);
|
543
|
-
form.querySelector('[type="submit"]').click();
|
544
|
-
return stopEverything(e);
|
545
|
-
};
|
546
|
-
|
547
|
-
}).call(this);
|
548
|
-
(function() {
|
549
|
-
var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
|
550
|
-
slice = [].slice;
|
551
|
-
|
552
|
-
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;
|
553
|
-
|
554
|
-
isRemote = function(element) {
|
555
|
-
var value;
|
556
|
-
value = element.getAttribute('data-remote');
|
557
|
-
return (value != null) && value !== 'false';
|
558
|
-
};
|
559
|
-
|
560
|
-
Rails.handleRemote = function(e) {
|
561
|
-
var button, data, dataType, element, method, url, withCredentials;
|
562
|
-
element = this;
|
563
|
-
if (!isRemote(element)) {
|
564
|
-
return true;
|
565
|
-
}
|
566
|
-
if (!fire(element, 'ajax:before')) {
|
567
|
-
fire(element, 'ajax:stopped');
|
568
|
-
return false;
|
569
|
-
}
|
570
|
-
withCredentials = element.getAttribute('data-with-credentials');
|
571
|
-
dataType = element.getAttribute('data-type') || 'script';
|
572
|
-
if (matches(element, Rails.formSubmitSelector)) {
|
573
|
-
button = getData(element, 'ujs:submit-button');
|
574
|
-
method = getData(element, 'ujs:submit-button-formmethod') || element.method;
|
575
|
-
url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
|
576
|
-
if (method.toUpperCase() === 'GET') {
|
577
|
-
url = url.replace(/\?.*$/, '');
|
578
|
-
}
|
579
|
-
if (element.enctype === 'multipart/form-data') {
|
580
|
-
data = new FormData(element);
|
581
|
-
if (button != null) {
|
582
|
-
data.append(button.name, button.value);
|
583
|
-
}
|
584
|
-
} else {
|
585
|
-
data = serializeElement(element, button);
|
586
|
-
}
|
587
|
-
setData(element, 'ujs:submit-button', null);
|
588
|
-
setData(element, 'ujs:submit-button-formmethod', null);
|
589
|
-
setData(element, 'ujs:submit-button-formaction', null);
|
590
|
-
} else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
|
591
|
-
method = element.getAttribute('data-method');
|
592
|
-
url = element.getAttribute('data-url');
|
593
|
-
data = serializeElement(element, element.getAttribute('data-params'));
|
594
|
-
} else {
|
595
|
-
method = element.getAttribute('data-method');
|
596
|
-
url = Rails.href(element);
|
597
|
-
data = element.getAttribute('data-params');
|
598
|
-
}
|
599
|
-
ajax({
|
600
|
-
type: method || 'GET',
|
601
|
-
url: url,
|
602
|
-
data: data,
|
603
|
-
dataType: dataType,
|
604
|
-
beforeSend: function(xhr, options) {
|
605
|
-
if (fire(element, 'ajax:beforeSend', [xhr, options])) {
|
606
|
-
return fire(element, 'ajax:send', [xhr]);
|
607
|
-
} else {
|
608
|
-
fire(element, 'ajax:stopped');
|
609
|
-
return false;
|
610
|
-
}
|
611
|
-
},
|
612
|
-
success: function() {
|
613
|
-
var args;
|
614
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
615
|
-
return fire(element, 'ajax:success', args);
|
616
|
-
},
|
617
|
-
error: function() {
|
618
|
-
var args;
|
619
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
620
|
-
return fire(element, 'ajax:error', args);
|
621
|
-
},
|
622
|
-
complete: function() {
|
623
|
-
var args;
|
624
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
625
|
-
return fire(element, 'ajax:complete', args);
|
626
|
-
},
|
627
|
-
crossDomain: isCrossDomain(url),
|
628
|
-
withCredentials: (withCredentials != null) && withCredentials !== 'false'
|
629
|
-
});
|
630
|
-
return stopEverything(e);
|
631
|
-
};
|
632
|
-
|
633
|
-
Rails.formSubmitButtonClick = function(e) {
|
634
|
-
var button, form;
|
635
|
-
button = this;
|
636
|
-
form = button.form;
|
637
|
-
if (!form) {
|
638
|
-
return;
|
639
|
-
}
|
640
|
-
if (button.name) {
|
641
|
-
setData(form, 'ujs:submit-button', {
|
642
|
-
name: button.name,
|
643
|
-
value: button.value
|
644
|
-
});
|
645
|
-
}
|
646
|
-
setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
|
647
|
-
setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
|
648
|
-
return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
|
649
|
-
};
|
650
|
-
|
651
|
-
Rails.preventInsignificantClick = function(e) {
|
652
|
-
var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
|
653
|
-
link = this;
|
654
|
-
method = (link.getAttribute('data-method') || 'GET').toUpperCase();
|
655
|
-
data = link.getAttribute('data-params');
|
656
|
-
metaClick = e.metaKey || e.ctrlKey;
|
657
|
-
insignificantMetaClick = metaClick && method === 'GET' && !data;
|
658
|
-
nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
|
659
|
-
if (nonPrimaryMouseClick || insignificantMetaClick) {
|
660
|
-
return e.stopImmediatePropagation();
|
661
|
-
}
|
662
|
-
};
|
663
|
-
|
664
|
-
}).call(this);
|
665
|
-
(function() {
|
666
|
-
var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
|
667
|
-
|
668
|
-
fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
|
669
|
-
|
670
|
-
if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
|
671
|
-
if (jQuery.rails) {
|
672
|
-
throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');
|
673
|
-
}
|
674
|
-
jQuery.rails = Rails;
|
675
|
-
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
|
676
|
-
if (!options.crossDomain) {
|
677
|
-
return CSRFProtection(xhr);
|
678
|
-
}
|
679
|
-
});
|
680
|
-
}
|
681
|
-
|
682
|
-
Rails.start = function() {
|
683
|
-
if (window._rails_loaded) {
|
684
|
-
throw new Error('rails-ujs has already been loaded!');
|
685
|
-
}
|
686
|
-
window.addEventListener('pageshow', function() {
|
687
|
-
$(Rails.formEnableSelector).forEach(function(el) {
|
688
|
-
if (getData(el, 'ujs:disabled')) {
|
689
|
-
return enableElement(el);
|
690
|
-
}
|
691
|
-
});
|
692
|
-
return $(Rails.linkDisableSelector).forEach(function(el) {
|
693
|
-
if (getData(el, 'ujs:disabled')) {
|
694
|
-
return enableElement(el);
|
695
|
-
}
|
696
|
-
});
|
697
|
-
});
|
698
|
-
delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
|
699
|
-
delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
|
700
|
-
delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
|
701
|
-
delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
|
702
|
-
delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);
|
703
|
-
delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);
|
704
|
-
delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
|
705
|
-
delegate(document, Rails.linkClickSelector, 'click', disableElement);
|
706
|
-
delegate(document, Rails.linkClickSelector, 'click', handleRemote);
|
707
|
-
delegate(document, Rails.linkClickSelector, 'click', handleMethod);
|
708
|
-
delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);
|
709
|
-
delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);
|
710
|
-
delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
|
711
|
-
delegate(document, Rails.buttonClickSelector, 'click', disableElement);
|
712
|
-
delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
|
713
|
-
delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);
|
714
|
-
delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
|
715
|
-
delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
|
716
|
-
delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);
|
717
|
-
delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
|
718
|
-
delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
|
719
|
-
delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
|
720
|
-
return setTimeout((function() {
|
721
|
-
return disableElement(e);
|
722
|
-
}), 13);
|
723
|
-
});
|
724
|
-
delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
|
725
|
-
delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
|
726
|
-
delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);
|
727
|
-
delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);
|
728
|
-
delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
|
729
|
-
delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
|
730
|
-
document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
|
731
|
-
document.addEventListener('DOMContentLoaded', loadCSPNonce);
|
732
|
-
return window._rails_loaded = true;
|
733
|
-
};
|
734
|
-
|
735
|
-
if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
|
736
|
-
Rails.start();
|
737
|
-
}
|
738
|
-
|
739
|
-
}).call(this);
|
740
|
-
}).call(this);
|
741
|
-
|
742
|
-
if (typeof module === "object" && module.exports) {
|
743
|
-
module.exports = Rails;
|
744
|
-
} else if (typeof define === "function" && define.amd) {
|
745
|
-
define(Rails);
|
746
|
-
}
|
747
|
-
}).call(this);
|
1
|
+
/**
|
2
|
+
* Minified by jsDelivr using Terser v5.15.1.
|
3
|
+
* Original file: /npm/@rails/ujs@7.0.4-2/lib/assets/compiled/rails-ujs.js
|
4
|
+
*
|
5
|
+
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
6
|
+
*/
|
7
|
+
(function(){(function(){(function(){this.Rails={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",buttonClickSelector:{selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"},inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form:not([data-turbo=true])",formInputClickSelector:"form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",formDisableSelector:"input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",formEnableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",fileInputSelector:"input[name][type=file]:not([disabled])",linkDisableSelector:"a[data-disable-with], a[data-disable]",buttonDisableSelector:"button[data-remote][data-disable-with], button[data-remote][data-disable]"}}).call(this)}).call(this);var t=this.Rails;(function(){(function(){var e;e=null,t.loadCSPNonce=function(){var t;return e=null!=(t=document.querySelector("meta[name=csp-nonce]"))?t.content:void 0},t.cspNonce=function(){return null!=e?e:t.loadCSPNonce()}}).call(this),function(){var e;e=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,t.matches=function(t,n){return null!=n.exclude?e.call(t,n.selector)&&!e.call(t,n.exclude):e.call(t,n)},t.getData=function(t,e){var n;return null!=(n=t._ujsData)?n[e]:void 0},t.setData=function(t,e,n){return null==t._ujsData&&(t._ujsData={}),t._ujsData[e]=n},t.$=function(t){return Array.prototype.slice.call(document.querySelectorAll(t))}}.call(this),function(){var e,n,a;e=t.$,a=t.csrfToken=function(){var t;return(t=document.querySelector("meta[name=csrf-token]"))&&t.content},n=t.csrfParam=function(){var t;return(t=document.querySelector("meta[name=csrf-param]"))&&t.content},t.CSRFProtection=function(t){var e;if(null!=(e=a()))return t.setRequestHeader("X-CSRF-Token",e)},t.refreshCSRFTokens=function(){var t,r;if(r=a(),t=n(),null!=r&&null!=t)return e('form input[name="'+t+'"]').forEach((function(t){return t.value=r}))}}.call(this),function(){var e,n,a,r;a=t.matches,"function"!=typeof(e=window.CustomEvent)&&((e=function(t,e){var n;return(n=document.createEvent("CustomEvent")).initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}).prototype=window.Event.prototype,r=e.prototype.preventDefault,e.prototype.preventDefault=function(){var t;return t=r.call(this),this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),t}),n=t.fire=function(t,n,a){var r;return r=new e(n,{bubbles:!0,cancelable:!0,detail:a}),t.dispatchEvent(r),!r.defaultPrevented},t.stopEverything=function(t){return n(t.target,"ujs:everythingStopped"),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()},t.delegate=function(t,e,n,r){return t.addEventListener(n,(function(t){var n;for(n=t.target;n instanceof Element&&!a(n,e);)n=n.parentNode;if(n instanceof Element&&!1===r.call(n,t))return t.preventDefault(),t.stopPropagation()}))}}.call(this),function(){var e,n,a,r,o,i;r=t.cspNonce,n=t.CSRFProtection,t.fire,e={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},t.ajax=function(t){var e;return t=o(t),e=a(t,(function(){var n,a;return a=i(null!=(n=e.response)?n:e.responseText,e.getResponseHeader("Content-Type")),2===Math.floor(e.status/100)?"function"==typeof t.success&&t.success(a,e.statusText,e):"function"==typeof t.error&&t.error(a,e.statusText,e),"function"==typeof t.complete?t.complete(e,e.statusText):void 0})),!(null!=t.beforeSend&&!t.beforeSend(e,t))&&(e.readyState===XMLHttpRequest.OPENED?e.send(t.data):void 0)},o=function(t){return t.url=t.url||location.href,t.type=t.type.toUpperCase(),"GET"===t.type&&t.data&&(t.url.indexOf("?")<0?t.url+="?"+t.data:t.url+="&"+t.data),null==e[t.dataType]&&(t.dataType="*"),t.accept=e[t.dataType],"*"!==t.dataType&&(t.accept+=", */*; q=0.01"),t},a=function(t,e){var a;return(a=new XMLHttpRequest).open(t.type,t.url,!0),a.setRequestHeader("Accept",t.accept),"string"==typeof t.data&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),t.crossDomain||(a.setRequestHeader("X-Requested-With","XMLHttpRequest"),n(a)),a.withCredentials=!!t.withCredentials,a.onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE)return e(a)},a},i=function(t,e){var n,a;if("string"==typeof t&&"string"==typeof e)if(e.match(/\bjson\b/))try{t=JSON.parse(t)}catch(t){}else if(e.match(/\b(?:java|ecma)script\b/))(a=document.createElement("script")).setAttribute("nonce",r()),a.text=t,document.head.appendChild(a).parentNode.removeChild(a);else if(e.match(/\b(xml|html|svg)\b/)){n=new DOMParser,e=e.replace(/;.+/,"");try{t=n.parseFromString(t,e)}catch(t){}}return t},t.href=function(t){return t.href},t.isCrossDomain=function(t){var e,n;(e=document.createElement("a")).href=location.href,n=document.createElement("a");try{return n.href=t,!((!n.protocol||":"===n.protocol)&&!n.host||e.protocol+"//"+e.host==n.protocol+"//"+n.host)}catch(t){return t,!0}}}.call(this),function(){var e,n;e=t.matches,n=function(t){return Array.prototype.slice.call(t)},t.serializeElement=function(t,a){var r,o;return r=[t],e(t,"form")&&(r=n(t.elements)),o=[],r.forEach((function(t){if(t.name&&!t.disabled&&!e(t,"fieldset[disabled] *"))return e(t,"select")?n(t.options).forEach((function(e){if(e.selected)return o.push({name:t.name,value:e.value})})):t.checked||-1===["radio","checkbox","submit"].indexOf(t.type)?o.push({name:t.name,value:t.value}):void 0})),a&&o.push(a),o.map((function(t){return null!=t.name?encodeURIComponent(t.name)+"="+encodeURIComponent(t.value):t})).join("&")},t.formElements=function(t,a){return e(t,"form")?n(t.elements).filter((function(t){return e(t,a)})):n(t.querySelectorAll(a))}}.call(this),function(){var e,n,a;n=t.fire,a=t.stopEverything,t.handleConfirm=function(t){if(!e(this))return a(t)},t.confirm=function(t,e){return confirm(t)},e=function(e){var a,r,o;if(!(o=e.getAttribute("data-confirm")))return!0;if(a=!1,n(e,"confirm")){try{a=t.confirm(o,e)}catch(t){}r=n(e,"confirm:complete",[a])}return a&&r}}.call(this),function(){var e,n,a,r,o,i,l,u,c,s,d,m;s=t.matches,u=t.getData,d=t.setData,m=t.stopEverything,l=t.formElements,t.handleDisabledElement=function(t){if(this,this.disabled)return m(t)},t.enableElement=function(e){var n;if(e instanceof Event){if(c(e))return;n=e.target}else n=e;return s(n,t.linkDisableSelector)?i(n):s(n,t.buttonDisableSelector)||s(n,t.formEnableSelector)?r(n):s(n,t.formSubmitSelector)?o(n):void 0},t.disableElement=function(r){var o;return o=r instanceof Event?r.target:r,s(o,t.linkDisableSelector)?a(o):s(o,t.buttonDisableSelector)||s(o,t.formDisableSelector)?e(o):s(o,t.formSubmitSelector)?n(o):void 0},a=function(t){var e;if(!u(t,"ujs:disabled"))return null!=(e=t.getAttribute("data-disable-with"))&&(d(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e),t.addEventListener("click",m),d(t,"ujs:disabled",!0)},i=function(t){var e;return null!=(e=u(t,"ujs:enable-with"))&&(t.innerHTML=e,d(t,"ujs:enable-with",null)),t.removeEventListener("click",m),d(t,"ujs:disabled",null)},n=function(n){return l(n,t.formDisableSelector).forEach(e)},e=function(t){var e;if(!u(t,"ujs:disabled"))return null!=(e=t.getAttribute("data-disable-with"))&&(s(t,"button")?(d(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e):(d(t,"ujs:enable-with",t.value),t.value=e)),t.disabled=!0,d(t,"ujs:disabled",!0)},o=function(e){return l(e,t.formEnableSelector).forEach(r)},r=function(t){var e;return null!=(e=u(t,"ujs:enable-with"))&&(s(t,"button")?t.innerHTML=e:t.value=e,d(t,"ujs:enable-with",null)),t.disabled=!1,d(t,"ujs:disabled",null)},c=function(t){var e,n;return null!=(null!=(n=null!=(e=t.detail)?e[0]:void 0)?n.getResponseHeader("X-Xhr-Redirect"):void 0)}}.call(this),function(){var e;e=t.stopEverything,t.handleMethod=function(n){var a,r,o,i,l,u,c;if(c=(u=this).getAttribute("data-method"))return l=t.href(u),r=t.csrfToken(),a=t.csrfParam(),o=document.createElement("form"),i="<input name='_method' value='"+c+"' type='hidden' />",null==a||null==r||t.isCrossDomain(l)||(i+="<input name='"+a+"' value='"+r+"' type='hidden' />"),i+='<input type="submit" />',o.method="post",o.action=l,o.target=u.target,o.innerHTML=i,o.style.display="none",document.body.appendChild(o),o.querySelector('[type="submit"]').click(),e(n)}}.call(this),function(){var e,n,a,r,o,i,l,u,c,s=[].slice;i=t.matches,a=t.getData,u=t.setData,n=t.fire,c=t.stopEverything,e=t.ajax,r=t.isCrossDomain,l=t.serializeElement,o=function(t){var e;return null!=(e=t.getAttribute("data-remote"))&&"false"!==e},t.handleRemote=function(d){var m,f,p,b,h,v,S;return!o(b=this)||(n(b,"ajax:before")?(S=b.getAttribute("data-with-credentials"),p=b.getAttribute("data-type")||"script",i(b,t.formSubmitSelector)?(m=a(b,"ujs:submit-button"),h=a(b,"ujs:submit-button-formmethod")||b.method,v=a(b,"ujs:submit-button-formaction")||b.getAttribute("action")||location.href,"GET"===h.toUpperCase()&&(v=v.replace(/\?.*$/,"")),"multipart/form-data"===b.enctype?(f=new FormData(b),null!=m&&f.append(m.name,m.value)):f=l(b,m),u(b,"ujs:submit-button",null),u(b,"ujs:submit-button-formmethod",null),u(b,"ujs:submit-button-formaction",null)):i(b,t.buttonClickSelector)||i(b,t.inputChangeSelector)?(h=b.getAttribute("data-method"),v=b.getAttribute("data-url"),f=l(b,b.getAttribute("data-params"))):(h=b.getAttribute("data-method"),v=t.href(b),f=b.getAttribute("data-params")),e({type:h||"GET",url:v,data:f,dataType:p,beforeSend:function(t,e){return n(b,"ajax:beforeSend",[t,e])?n(b,"ajax:send",[t]):(n(b,"ajax:stopped"),!1)},success:function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],n(b,"ajax:success",t)},error:function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],n(b,"ajax:error",t)},complete:function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],n(b,"ajax:complete",t)},crossDomain:r(v),withCredentials:null!=S&&"false"!==S}),c(d)):(n(b,"ajax:stopped"),!1))},t.formSubmitButtonClick=function(t){var e,n;if(n=(e=this).form)return e.name&&u(n,"ujs:submit-button",{name:e.name,value:e.value}),u(n,"ujs:formnovalidate-button",e.formNoValidate),u(n,"ujs:submit-button-formaction",e.getAttribute("formaction")),u(n,"ujs:submit-button-formmethod",e.getAttribute("formmethod"))},t.preventInsignificantClick=function(t){var e,n,a;if(this,a=(this.getAttribute("data-method")||"GET").toUpperCase(),e=this.getAttribute("data-params"),n=(t.metaKey||t.ctrlKey)&&"GET"===a&&!e,null!=t.button&&0!==t.button||n)return t.stopImmediatePropagation()}}.call(this),function(){var e,n,a,r,o,i,l,u,c,s,d,m,f,p,b;if(i=t.fire,a=t.delegate,u=t.getData,e=t.$,b=t.refreshCSRFTokens,n=t.CSRFProtection,f=t.loadCSPNonce,o=t.enableElement,r=t.disableElement,s=t.handleDisabledElement,c=t.handleConfirm,p=t.preventInsignificantClick,m=t.handleRemote,l=t.formSubmitButtonClick,d=t.handleMethod,"undefined"!=typeof jQuery&&null!==jQuery&&null!=jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=t,jQuery.ajaxPrefilter((function(t,e,a){if(!t.crossDomain)return n(a)}))}t.start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");return window.addEventListener("pageshow",(function(){return e(t.formEnableSelector).forEach((function(t){if(u(t,"ujs:disabled"))return o(t)})),e(t.linkDisableSelector).forEach((function(t){if(u(t,"ujs:disabled"))return o(t)}))})),a(document,t.linkDisableSelector,"ajax:complete",o),a(document,t.linkDisableSelector,"ajax:stopped",o),a(document,t.buttonDisableSelector,"ajax:complete",o),a(document,t.buttonDisableSelector,"ajax:stopped",o),a(document,t.linkClickSelector,"click",p),a(document,t.linkClickSelector,"click",s),a(document,t.linkClickSelector,"click",c),a(document,t.linkClickSelector,"click",r),a(document,t.linkClickSelector,"click",m),a(document,t.linkClickSelector,"click",d),a(document,t.buttonClickSelector,"click",p),a(document,t.buttonClickSelector,"click",s),a(document,t.buttonClickSelector,"click",c),a(document,t.buttonClickSelector,"click",r),a(document,t.buttonClickSelector,"click",m),a(document,t.inputChangeSelector,"change",s),a(document,t.inputChangeSelector,"change",c),a(document,t.inputChangeSelector,"change",m),a(document,t.formSubmitSelector,"submit",s),a(document,t.formSubmitSelector,"submit",c),a(document,t.formSubmitSelector,"submit",m),a(document,t.formSubmitSelector,"submit",(function(t){return setTimeout((function(){return r(t)}),13)})),a(document,t.formSubmitSelector,"ajax:send",r),a(document,t.formSubmitSelector,"ajax:complete",o),a(document,t.formInputClickSelector,"click",p),a(document,t.formInputClickSelector,"click",s),a(document,t.formInputClickSelector,"click",c),a(document,t.formInputClickSelector,"click",l),document.addEventListener("DOMContentLoaded",b),document.addEventListener("DOMContentLoaded",f),window._rails_loaded=!0},window.Rails===t&&i(document,"rails:attachBindings")&&t.start()}.call(this)}).call(this),"object"==typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd&&define(t)}).call(this);
|