938 lines
35 KiB
JavaScript
938 lines
35 KiB
JavaScript
/******/ (() => { // webpackBootstrap
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ "./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js":
|
|
/*!******************************************************************!*\
|
|
!*** ./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js ***!
|
|
\******************************************************************/
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
Unobtrusive JavaScript
|
|
https://github.com/rails/rails/blob/main/actionview/app/assets/javascripts
|
|
Released under the MIT license
|
|
*/;
|
|
|
|
(function() {
|
|
var context = this;
|
|
|
|
(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(context);
|
|
|
|
var Rails = context.Rails;
|
|
|
|
(function() {
|
|
(function() {
|
|
var nonce;
|
|
|
|
nonce = null;
|
|
|
|
Rails.loadCSPNonce = function() {
|
|
var ref;
|
|
return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
|
|
};
|
|
|
|
Rails.cspNonce = function() {
|
|
return nonce != null ? nonce : Rails.loadCSPNonce();
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var expando, m;
|
|
|
|
m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
|
|
Rails.matches = function(element, selector) {
|
|
if (selector.exclude != null) {
|
|
return m.call(element, selector.selector) && !m.call(element, selector.exclude);
|
|
} else {
|
|
return m.call(element, selector);
|
|
}
|
|
};
|
|
|
|
expando = '_ujsData';
|
|
|
|
Rails.getData = function(element, key) {
|
|
var ref;
|
|
return (ref = element[expando]) != null ? ref[key] : void 0;
|
|
};
|
|
|
|
Rails.setData = function(element, key, value) {
|
|
if (element[expando] == null) {
|
|
element[expando] = {};
|
|
}
|
|
return element[expando][key] = value;
|
|
};
|
|
|
|
Rails.$ = function(selector) {
|
|
return Array.prototype.slice.call(document.querySelectorAll(selector));
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var $, csrfParam, csrfToken;
|
|
|
|
$ = Rails.$;
|
|
|
|
csrfToken = Rails.csrfToken = function() {
|
|
var meta;
|
|
meta = document.querySelector('meta[name=csrf-token]');
|
|
return meta && meta.content;
|
|
};
|
|
|
|
csrfParam = Rails.csrfParam = function() {
|
|
var meta;
|
|
meta = document.querySelector('meta[name=csrf-param]');
|
|
return meta && meta.content;
|
|
};
|
|
|
|
Rails.CSRFProtection = function(xhr) {
|
|
var token;
|
|
token = csrfToken();
|
|
if (token != null) {
|
|
return xhr.setRequestHeader('X-CSRF-Token', token);
|
|
}
|
|
};
|
|
|
|
Rails.refreshCSRFTokens = function() {
|
|
var param, token;
|
|
token = csrfToken();
|
|
param = csrfParam();
|
|
if ((token != null) && (param != null)) {
|
|
return $('form input[name="' + param + '"]').forEach(function(input) {
|
|
return input.value = token;
|
|
});
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var CustomEvent, fire, matches, preventDefault;
|
|
|
|
matches = Rails.matches;
|
|
|
|
CustomEvent = window.CustomEvent;
|
|
|
|
if (typeof CustomEvent !== 'function') {
|
|
CustomEvent = function(event, params) {
|
|
var evt;
|
|
evt = document.createEvent('CustomEvent');
|
|
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
return evt;
|
|
};
|
|
CustomEvent.prototype = window.Event.prototype;
|
|
preventDefault = CustomEvent.prototype.preventDefault;
|
|
CustomEvent.prototype.preventDefault = function() {
|
|
var result;
|
|
result = preventDefault.call(this);
|
|
if (this.cancelable && !this.defaultPrevented) {
|
|
Object.defineProperty(this, 'defaultPrevented', {
|
|
get: function() {
|
|
return true;
|
|
}
|
|
});
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
|
|
fire = Rails.fire = function(obj, name, data) {
|
|
var event;
|
|
event = new CustomEvent(name, {
|
|
bubbles: true,
|
|
cancelable: true,
|
|
detail: data
|
|
});
|
|
obj.dispatchEvent(event);
|
|
return !event.defaultPrevented;
|
|
};
|
|
|
|
Rails.stopEverything = function(e) {
|
|
fire(e.target, 'ujs:everythingStopped');
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
return e.stopImmediatePropagation();
|
|
};
|
|
|
|
Rails.delegate = function(element, selector, eventType, handler) {
|
|
return element.addEventListener(eventType, function(e) {
|
|
var target;
|
|
target = e.target;
|
|
while (!(!(target instanceof Element) || matches(target, selector))) {
|
|
target = target.parentNode;
|
|
}
|
|
if (target instanceof Element && handler.call(target, e) === false) {
|
|
e.preventDefault();
|
|
return e.stopPropagation();
|
|
}
|
|
});
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
|
|
|
|
cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
|
|
|
|
AcceptHeaders = {
|
|
'*': '*/*',
|
|
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'
|
|
};
|
|
|
|
Rails.ajax = function(options) {
|
|
var xhr;
|
|
options = prepareOptions(options);
|
|
xhr = createXHR(options, function() {
|
|
var ref, response;
|
|
response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));
|
|
if (Math.floor(xhr.status / 100) === 2) {
|
|
if (typeof options.success === "function") {
|
|
options.success(response, xhr.statusText, xhr);
|
|
}
|
|
} else {
|
|
if (typeof options.error === "function") {
|
|
options.error(response, xhr.statusText, xhr);
|
|
}
|
|
}
|
|
return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
|
|
});
|
|
if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) {
|
|
return false;
|
|
}
|
|
if (xhr.readyState === XMLHttpRequest.OPENED) {
|
|
return xhr.send(options.data);
|
|
}
|
|
};
|
|
|
|
prepareOptions = function(options) {
|
|
options.url = options.url || location.href;
|
|
options.type = options.type.toUpperCase();
|
|
if (options.type === 'GET' && options.data) {
|
|
if (options.url.indexOf('?') < 0) {
|
|
options.url += '?' + options.data;
|
|
} else {
|
|
options.url += '&' + options.data;
|
|
}
|
|
}
|
|
if (AcceptHeaders[options.dataType] == null) {
|
|
options.dataType = '*';
|
|
}
|
|
options.accept = AcceptHeaders[options.dataType];
|
|
if (options.dataType !== '*') {
|
|
options.accept += ', */*; q=0.01';
|
|
}
|
|
return options;
|
|
};
|
|
|
|
createXHR = function(options, done) {
|
|
var xhr;
|
|
xhr = new XMLHttpRequest();
|
|
xhr.open(options.type, options.url, true);
|
|
xhr.setRequestHeader('Accept', options.accept);
|
|
if (typeof options.data === 'string') {
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
|
}
|
|
if (!options.crossDomain) {
|
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
CSRFProtection(xhr);
|
|
}
|
|
xhr.withCredentials = !!options.withCredentials;
|
|
xhr.onreadystatechange = function() {
|
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
return done(xhr);
|
|
}
|
|
};
|
|
return xhr;
|
|
};
|
|
|
|
processResponse = function(response, type) {
|
|
var parser, script;
|
|
if (typeof response === 'string' && typeof type === 'string') {
|
|
if (type.match(/\bjson\b/)) {
|
|
try {
|
|
response = JSON.parse(response);
|
|
} catch (error) {}
|
|
} else if (type.match(/\b(?:java|ecma)script\b/)) {
|
|
script = document.createElement('script');
|
|
script.setAttribute('nonce', cspNonce());
|
|
script.text = response;
|
|
document.head.appendChild(script).parentNode.removeChild(script);
|
|
} else if (type.match(/\b(xml|html|svg)\b/)) {
|
|
parser = new DOMParser();
|
|
type = type.replace(/;.+/, '');
|
|
try {
|
|
response = parser.parseFromString(response, type);
|
|
} catch (error) {}
|
|
}
|
|
}
|
|
return response;
|
|
};
|
|
|
|
Rails.href = function(element) {
|
|
return element.href;
|
|
};
|
|
|
|
Rails.isCrossDomain = function(url) {
|
|
var e, originAnchor, urlAnchor;
|
|
originAnchor = document.createElement('a');
|
|
originAnchor.href = location.href;
|
|
urlAnchor = document.createElement('a');
|
|
try {
|
|
urlAnchor.href = url;
|
|
return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
|
|
} catch (error) {
|
|
e = error;
|
|
return true;
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var matches, toArray;
|
|
|
|
matches = Rails.matches;
|
|
|
|
toArray = function(e) {
|
|
return Array.prototype.slice.call(e);
|
|
};
|
|
|
|
Rails.serializeElement = function(element, additionalParam) {
|
|
var inputs, params;
|
|
inputs = [element];
|
|
if (matches(element, 'form')) {
|
|
inputs = toArray(element.elements);
|
|
}
|
|
params = [];
|
|
inputs.forEach(function(input) {
|
|
if (!input.name || input.disabled) {
|
|
return;
|
|
}
|
|
if (matches(input, 'fieldset[disabled] *')) {
|
|
return;
|
|
}
|
|
if (matches(input, 'select')) {
|
|
return toArray(input.options).forEach(function(option) {
|
|
if (option.selected) {
|
|
return params.push({
|
|
name: input.name,
|
|
value: option.value
|
|
});
|
|
}
|
|
});
|
|
} else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {
|
|
return params.push({
|
|
name: input.name,
|
|
value: input.value
|
|
});
|
|
}
|
|
});
|
|
if (additionalParam) {
|
|
params.push(additionalParam);
|
|
}
|
|
return params.map(function(param) {
|
|
if (param.name != null) {
|
|
return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
|
|
} else {
|
|
return param;
|
|
}
|
|
}).join('&');
|
|
};
|
|
|
|
Rails.formElements = function(form, selector) {
|
|
if (matches(form, 'form')) {
|
|
return toArray(form.elements).filter(function(el) {
|
|
return matches(el, selector);
|
|
});
|
|
} else {
|
|
return toArray(form.querySelectorAll(selector));
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var allowAction, fire, stopEverything;
|
|
|
|
fire = Rails.fire, stopEverything = Rails.stopEverything;
|
|
|
|
Rails.handleConfirm = function(e) {
|
|
if (!allowAction(this)) {
|
|
return stopEverything(e);
|
|
}
|
|
};
|
|
|
|
Rails.confirm = function(message, element) {
|
|
return confirm(message);
|
|
};
|
|
|
|
allowAction = function(element) {
|
|
var answer, callback, message;
|
|
message = element.getAttribute('data-confirm');
|
|
if (!message) {
|
|
return true;
|
|
}
|
|
answer = false;
|
|
if (fire(element, 'confirm')) {
|
|
try {
|
|
answer = Rails.confirm(message, element);
|
|
} catch (error) {}
|
|
callback = fire(element, 'confirm:complete', [answer]);
|
|
}
|
|
return answer && callback;
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;
|
|
|
|
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
|
|
|
|
Rails.handleDisabledElement = function(e) {
|
|
var element;
|
|
element = this;
|
|
if (element.disabled) {
|
|
return stopEverything(e);
|
|
}
|
|
};
|
|
|
|
Rails.enableElement = function(e) {
|
|
var element;
|
|
if (e instanceof Event) {
|
|
if (isXhrRedirect(e)) {
|
|
return;
|
|
}
|
|
element = e.target;
|
|
} else {
|
|
element = e;
|
|
}
|
|
if (matches(element, Rails.linkDisableSelector)) {
|
|
return enableLinkElement(element);
|
|
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
|
|
return enableFormElement(element);
|
|
} else if (matches(element, Rails.formSubmitSelector)) {
|
|
return enableFormElements(element);
|
|
}
|
|
};
|
|
|
|
Rails.disableElement = function(e) {
|
|
var element;
|
|
element = e instanceof Event ? e.target : e;
|
|
if (matches(element, Rails.linkDisableSelector)) {
|
|
return disableLinkElement(element);
|
|
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
|
|
return disableFormElement(element);
|
|
} else if (matches(element, Rails.formSubmitSelector)) {
|
|
return disableFormElements(element);
|
|
}
|
|
};
|
|
|
|
disableLinkElement = function(element) {
|
|
var replacement;
|
|
if (getData(element, 'ujs:disabled')) {
|
|
return;
|
|
}
|
|
replacement = element.getAttribute('data-disable-with');
|
|
if (replacement != null) {
|
|
setData(element, 'ujs:enable-with', element.innerHTML);
|
|
element.innerHTML = replacement;
|
|
}
|
|
element.addEventListener('click', stopEverything);
|
|
return setData(element, 'ujs:disabled', true);
|
|
};
|
|
|
|
enableLinkElement = function(element) {
|
|
var originalText;
|
|
originalText = getData(element, 'ujs:enable-with');
|
|
if (originalText != null) {
|
|
element.innerHTML = originalText;
|
|
setData(element, 'ujs:enable-with', null);
|
|
}
|
|
element.removeEventListener('click', stopEverything);
|
|
return setData(element, 'ujs:disabled', null);
|
|
};
|
|
|
|
disableFormElements = function(form) {
|
|
return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
|
|
};
|
|
|
|
disableFormElement = function(element) {
|
|
var replacement;
|
|
if (getData(element, 'ujs:disabled')) {
|
|
return;
|
|
}
|
|
replacement = element.getAttribute('data-disable-with');
|
|
if (replacement != null) {
|
|
if (matches(element, 'button')) {
|
|
setData(element, 'ujs:enable-with', element.innerHTML);
|
|
element.innerHTML = replacement;
|
|
} else {
|
|
setData(element, 'ujs:enable-with', element.value);
|
|
element.value = replacement;
|
|
}
|
|
}
|
|
element.disabled = true;
|
|
return setData(element, 'ujs:disabled', true);
|
|
};
|
|
|
|
enableFormElements = function(form) {
|
|
return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
|
|
};
|
|
|
|
enableFormElement = function(element) {
|
|
var originalText;
|
|
originalText = getData(element, 'ujs:enable-with');
|
|
if (originalText != null) {
|
|
if (matches(element, 'button')) {
|
|
element.innerHTML = originalText;
|
|
} else {
|
|
element.value = originalText;
|
|
}
|
|
setData(element, 'ujs:enable-with', null);
|
|
}
|
|
element.disabled = false;
|
|
return setData(element, 'ujs:disabled', null);
|
|
};
|
|
|
|
isXhrRedirect = function(event) {
|
|
var ref, xhr;
|
|
xhr = (ref = event.detail) != null ? ref[0] : void 0;
|
|
return (xhr != null ? xhr.getResponseHeader("X-Xhr-Redirect") : void 0) != null;
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var stopEverything;
|
|
|
|
stopEverything = Rails.stopEverything;
|
|
|
|
Rails.handleMethod = function(e) {
|
|
var csrfParam, csrfToken, form, formContent, href, link, method;
|
|
link = this;
|
|
method = link.getAttribute('data-method');
|
|
if (!method) {
|
|
return;
|
|
}
|
|
href = Rails.href(link);
|
|
csrfToken = Rails.csrfToken();
|
|
csrfParam = Rails.csrfParam();
|
|
form = document.createElement('form');
|
|
formContent = "<input name='_method' value='" + method + "' type='hidden' />";
|
|
if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
|
|
formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
|
|
}
|
|
formContent += '<input type="submit" />';
|
|
form.method = 'post';
|
|
form.action = href;
|
|
form.target = link.target;
|
|
form.innerHTML = formContent;
|
|
form.style.display = 'none';
|
|
document.body.appendChild(form);
|
|
form.querySelector('[type="submit"]').click();
|
|
return stopEverything(e);
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
|
|
slice = [].slice;
|
|
|
|
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;
|
|
|
|
isRemote = function(element) {
|
|
var value;
|
|
value = element.getAttribute('data-remote');
|
|
return (value != null) && value !== 'false';
|
|
};
|
|
|
|
Rails.handleRemote = function(e) {
|
|
var button, data, dataType, element, method, url, withCredentials;
|
|
element = this;
|
|
if (!isRemote(element)) {
|
|
return true;
|
|
}
|
|
if (!fire(element, 'ajax:before')) {
|
|
fire(element, 'ajax:stopped');
|
|
return false;
|
|
}
|
|
withCredentials = element.getAttribute('data-with-credentials');
|
|
dataType = element.getAttribute('data-type') || 'script';
|
|
if (matches(element, Rails.formSubmitSelector)) {
|
|
button = getData(element, 'ujs:submit-button');
|
|
method = getData(element, 'ujs:submit-button-formmethod') || element.method;
|
|
url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
|
|
if (method.toUpperCase() === 'GET') {
|
|
url = url.replace(/\?.*$/, '');
|
|
}
|
|
if (element.enctype === 'multipart/form-data') {
|
|
data = new FormData(element);
|
|
if (button != null) {
|
|
data.append(button.name, button.value);
|
|
}
|
|
} else {
|
|
data = serializeElement(element, button);
|
|
}
|
|
setData(element, 'ujs:submit-button', null);
|
|
setData(element, 'ujs:submit-button-formmethod', null);
|
|
setData(element, 'ujs:submit-button-formaction', null);
|
|
} else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
|
|
method = element.getAttribute('data-method');
|
|
url = element.getAttribute('data-url');
|
|
data = serializeElement(element, element.getAttribute('data-params'));
|
|
} else {
|
|
method = element.getAttribute('data-method');
|
|
url = Rails.href(element);
|
|
data = element.getAttribute('data-params');
|
|
}
|
|
ajax({
|
|
type: method || 'GET',
|
|
url: url,
|
|
data: data,
|
|
dataType: dataType,
|
|
beforeSend: function(xhr, options) {
|
|
if (fire(element, 'ajax:beforeSend', [xhr, options])) {
|
|
return fire(element, 'ajax:send', [xhr]);
|
|
} else {
|
|
fire(element, 'ajax:stopped');
|
|
return false;
|
|
}
|
|
},
|
|
success: function() {
|
|
var args;
|
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
return fire(element, 'ajax:success', args);
|
|
},
|
|
error: function() {
|
|
var args;
|
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
return fire(element, 'ajax:error', args);
|
|
},
|
|
complete: function() {
|
|
var args;
|
|
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
return fire(element, 'ajax:complete', args);
|
|
},
|
|
crossDomain: isCrossDomain(url),
|
|
withCredentials: (withCredentials != null) && withCredentials !== 'false'
|
|
});
|
|
return stopEverything(e);
|
|
};
|
|
|
|
Rails.formSubmitButtonClick = function(e) {
|
|
var button, form;
|
|
button = this;
|
|
form = button.form;
|
|
if (!form) {
|
|
return;
|
|
}
|
|
if (button.name) {
|
|
setData(form, 'ujs:submit-button', {
|
|
name: button.name,
|
|
value: button.value
|
|
});
|
|
}
|
|
setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
|
|
setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
|
|
return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
|
|
};
|
|
|
|
Rails.preventInsignificantClick = function(e) {
|
|
var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
|
|
link = this;
|
|
method = (link.getAttribute('data-method') || 'GET').toUpperCase();
|
|
data = link.getAttribute('data-params');
|
|
metaClick = e.metaKey || e.ctrlKey;
|
|
insignificantMetaClick = metaClick && method === 'GET' && !data;
|
|
nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
|
|
if (nonPrimaryMouseClick || insignificantMetaClick) {
|
|
return e.stopImmediatePropagation();
|
|
}
|
|
};
|
|
|
|
}).call(this);
|
|
(function() {
|
|
var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
|
|
|
|
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;
|
|
|
|
if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
|
|
if (jQuery.rails) {
|
|
throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');
|
|
}
|
|
jQuery.rails = Rails;
|
|
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
|
|
if (!options.crossDomain) {
|
|
return CSRFProtection(xhr);
|
|
}
|
|
});
|
|
}
|
|
|
|
Rails.start = function() {
|
|
if (window._rails_loaded) {
|
|
throw new Error('rails-ujs has already been loaded!');
|
|
}
|
|
window.addEventListener('pageshow', function() {
|
|
$(Rails.formEnableSelector).forEach(function(el) {
|
|
if (getData(el, 'ujs:disabled')) {
|
|
return enableElement(el);
|
|
}
|
|
});
|
|
return $(Rails.linkDisableSelector).forEach(function(el) {
|
|
if (getData(el, 'ujs:disabled')) {
|
|
return enableElement(el);
|
|
}
|
|
});
|
|
});
|
|
delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
|
|
delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
|
|
delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
|
|
delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
|
|
delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);
|
|
delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);
|
|
delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
|
|
delegate(document, Rails.linkClickSelector, 'click', disableElement);
|
|
delegate(document, Rails.linkClickSelector, 'click', handleRemote);
|
|
delegate(document, Rails.linkClickSelector, 'click', handleMethod);
|
|
delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);
|
|
delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);
|
|
delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
|
|
delegate(document, Rails.buttonClickSelector, 'click', disableElement);
|
|
delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
|
|
delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);
|
|
delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
|
|
delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
|
|
delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);
|
|
delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
|
|
delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
|
|
delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
|
|
return setTimeout((function() {
|
|
return disableElement(e);
|
|
}), 13);
|
|
});
|
|
delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
|
|
delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
|
|
delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);
|
|
delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);
|
|
delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
|
|
delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
|
|
document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
|
|
document.addEventListener('DOMContentLoaded', loadCSPNonce);
|
|
return window._rails_loaded = true;
|
|
};
|
|
|
|
if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
|
|
Rails.start();
|
|
}
|
|
|
|
}).call(this);
|
|
}).call(this);
|
|
|
|
if ( true && module.exports) {
|
|
module.exports = Rails;
|
|
} else if (true) {
|
|
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (Rails),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
}
|
|
}).call(this);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/js/app.js":
|
|
/*!***********************!*\
|
|
!*** ./src/js/app.js ***!
|
|
\***********************/
|
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
/* eslint no-console:0 */
|
|
// Rails Unobtrusive JavaScript (UJS) is *required* for links in Lucky that use DELETE, POST and PUT.
|
|
// Though it says "Rails" it actually works with any framework.
|
|
__webpack_require__(/*! @rails/ujs */ "./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js").start(); // Turbolinks is optional. Learn more: https://github.com/turbolinks/turbolinks/
|
|
// require("turbolinks").start();
|
|
// If using Turbolinks, you can attach events to page load like this:
|
|
//
|
|
// document.addEventListener("turbolinks:load", function() {
|
|
// ...
|
|
// })
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/css/app.scss":
|
|
/*!**************************!*\
|
|
!*** ./src/css/app.scss ***!
|
|
\**************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ // no module.id needed
|
|
/******/ // no module.loaded needed
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = __webpack_modules__;
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/chunk loaded */
|
|
/******/ (() => {
|
|
/******/ var deferred = [];
|
|
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
|
|
/******/ if(chunkIds) {
|
|
/******/ priority = priority || 0;
|
|
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
|
|
/******/ deferred[i] = [chunkIds, fn, priority];
|
|
/******/ return;
|
|
/******/ }
|
|
/******/ var notFulfilled = Infinity;
|
|
/******/ for (var i = 0; i < deferred.length; i++) {
|
|
/******/ var [chunkIds, fn, priority] = deferred[i];
|
|
/******/ var fulfilled = true;
|
|
/******/ for (var j = 0; j < chunkIds.length; j++) {
|
|
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
|
|
/******/ chunkIds.splice(j--, 1);
|
|
/******/ } else {
|
|
/******/ fulfilled = false;
|
|
/******/ if(priority < notFulfilled) notFulfilled = priority;
|
|
/******/ }
|
|
/******/ }
|
|
/******/ if(fulfilled) {
|
|
/******/ deferred.splice(i--, 1)
|
|
/******/ var r = fn();
|
|
/******/ if (r !== undefined) result = r;
|
|
/******/ }
|
|
/******/ }
|
|
/******/ return result;
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
/******/ (() => {
|
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ (() => {
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = (exports) => {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
/******/ (() => {
|
|
/******/ // no baseURI
|
|
/******/
|
|
/******/ // object to store loaded and loading chunks
|
|
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
/******/ var installedChunks = {
|
|
/******/ "/js/app": 0,
|
|
/******/ "css/app": 0
|
|
/******/ };
|
|
/******/
|
|
/******/ // no chunk on demand loading
|
|
/******/
|
|
/******/ // no prefetching
|
|
/******/
|
|
/******/ // no preloaded
|
|
/******/
|
|
/******/ // no HMR
|
|
/******/
|
|
/******/ // no HMR manifest
|
|
/******/
|
|
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
|
|
/******/
|
|
/******/ // install a JSONP callback for chunk loading
|
|
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
/******/ // add "moreModules" to the modules object,
|
|
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
/******/ var moduleId, chunkId, i = 0;
|
|
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
/******/ for(moduleId in moreModules) {
|
|
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
/******/ }
|
|
/******/ }
|
|
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
/******/ }
|
|
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
/******/ for(;i < chunkIds.length; i++) {
|
|
/******/ chunkId = chunkIds[i];
|
|
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
/******/ installedChunks[chunkId][0]();
|
|
/******/ }
|
|
/******/ installedChunks[chunkIds[i]] = 0;
|
|
/******/ }
|
|
/******/ return __webpack_require__.O(result);
|
|
/******/ }
|
|
/******/
|
|
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
|
|
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
/******/ })();
|
|
/******/
|
|
/************************************************************************/
|
|
/******/
|
|
/******/ // startup
|
|
/******/ // Load entry module and return exports
|
|
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
|
|
/******/ __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./src/js/app.js")))
|
|
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./src/css/app.scss")))
|
|
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
|
|
/******/
|
|
/******/ })()
|
|
; |