akkoma/priv/static/packs/flavours/glitch/common.js
2022-01-08 21:44:37 +00:00

2 lines
No EOL
14 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[86],{61:function(t,e,n){var a,r;(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",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form 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 o=this.Rails;(function(){(function(){var t;t=null,o.loadCSPNonce=function(){var e;return t=null!=(e=document.querySelector("meta[name=csp-nonce]"))?e.content:void 0},o.cspNonce=function(){return null!=t?t:o.loadCSPNonce()}}).call(this),function(){var t;t=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,o.matches=function(e,n){return null!=n.exclude?t.call(e,n.selector)&&!t.call(e,n.exclude):t.call(e,n)},o.getData=function(t,e){var n;return null!=(n=t._ujsData)?n[e]:void 0},o.setData=function(t,e,n){return null==t._ujsData&&(t._ujsData={}),t._ujsData[e]=n},o.$=function(t){return Array.prototype.slice.call(document.querySelectorAll(t))}}.call(this),function(){var t,e,n;t=o.$,n=o.csrfToken=function(){var t;return(t=document.querySelector("meta[name=csrf-token]"))&&t.content},e=o.csrfParam=function(){var t;return(t=document.querySelector("meta[name=csrf-param]"))&&t.content},o.CSRFProtection=function(t){var e;if(null!=(e=n()))return t.setRequestHeader("X-CSRF-Token",e)},o.refreshCSRFTokens=function(){var a,r;if(r=n(),a=e(),null!=r&&null!=a)return t('form input[name="'+a+'"]').forEach((function(t){return t.value=r}))}}.call(this),function(){var t,e,n,a;n=o.matches,"function"!=typeof(t=window.CustomEvent)&&((t=function(t,e){var n;return(n=document.createEvent("CustomEvent")).initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}).prototype=window.Event.prototype,a=t.prototype.preventDefault,t.prototype.preventDefault=function(){var t;return t=a.call(this),this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),t}),e=o.fire=function(e,n,a){var r;return r=new t(n,{bubbles:!0,cancelable:!0,detail:a}),e.dispatchEvent(r),!r.defaultPrevented},o.stopEverything=function(t){return e(t.target,"ujs:everythingStopped"),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()},o.delegate=function(t,e,a,r){return t.addEventListener(a,(function(t){var a;for(a=t.target;a instanceof Element&&!n(a,e);)a=a.parentNode;if(a instanceof Element&&!1===r.call(a,t))return t.preventDefault(),t.stopPropagation()}))}}.call(this),function(){var t,e,n,a,r,i;a=o.cspNonce,e=o.CSRFProtection,o.fire,t={"*":"*/*",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"},o.ajax=function(t){var e;return t=r(t),e=n(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)},r=function(e){return e.url=e.url||location.href,e.type=e.type.toUpperCase(),"GET"===e.type&&e.data&&(e.url.indexOf("?")<0?e.url+="?"+e.data:e.url+="&"+e.data),null==t[e.dataType]&&(e.dataType="*"),e.accept=t[e.dataType],"*"!==e.dataType&&(e.accept+=", */*; q=0.01"),e},n=function(t,n){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"),e(a),a.withCredentials=!!t.withCredentials,a.onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE)return n(a)},a},i=function(t,e){var n,r;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/))(r=document.createElement("script")).setAttribute("nonce",a()),r.text=t,document.head.appendChild(r).parentNode.removeChild(r);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},o.href=function(t){return t.href},o.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 t,e;t=o.matches,e=function(t){return Array.prototype.slice.call(t)},o.serializeElement=function(n,a){var r,o;return r=[n],t(n,"form")&&(r=e(n.elements)),o=[],r.forEach((function(n){if(n.name&&!n.disabled&&!t(n,"fieldset[disabled] *"))return t(n,"select")?e(n.options).forEach((function(t){if(t.selected)return o.push({name:n.name,value:t.value})})):n.checked||-1===["radio","checkbox","submit"].indexOf(n.type)?o.push({name:n.name,value:n.value}):void 0})),a&&o.push(a),o.map((function(t){return null!=t.name?encodeURIComponent(t.name)+"="+encodeURIComponent(t.value):t})).join("&")},o.formElements=function(n,a){return t(n,"form")?e(n.elements).filter((function(e){return t(e,a)})):e(n.querySelectorAll(a))}}.call(this),function(){var t,e,n;e=o.fire,n=o.stopEverything,o.handleConfirm=function(e){if(!t(this))return n(e)},o.confirm=function(t,e){return confirm(t)},t=function(t){var n,a,r;if(!(r=t.getAttribute("data-confirm")))return!0;if(n=!1,e(t,"confirm")){try{n=o.confirm(r,t)}catch(t){}a=e(t,"confirm:complete",[n])}return n&&a}}.call(this),function(){var t,e,n,a,r,i,l,u,c,s,d,m;s=o.matches,u=o.getData,d=o.setData,m=o.stopEverything,l=o.formElements,o.handleDisabledElement=function(t){if(this,this.disabled)return m(t)},o.enableElement=function(t){var e;if(t instanceof Event){if(c(t))return;e=t.target}else e=t;return s(e,o.linkDisableSelector)?i(e):s(e,o.buttonDisableSelector)||s(e,o.formEnableSelector)?a(e):s(e,o.formSubmitSelector)?r(e):void 0},o.disableElement=function(a){var r;return r=a instanceof Event?a.target:a,s(r,o.linkDisableSelector)?n(r):s(r,o.buttonDisableSelector)||s(r,o.formDisableSelector)?t(r):s(r,o.formSubmitSelector)?e(r):void 0},n=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)},e=function(e){return l(e,o.formDisableSelector).forEach(t)},t=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)},r=function(t){return l(t,o.formEnableSelector).forEach(a)},a=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 t;t=o.stopEverything,o.handleMethod=function(e){var n,a,r,i,l,u;if(this,u=this.getAttribute("data-method"))return l=o.href(this),a=o.csrfToken(),n=o.csrfParam(),r=document.createElement("form"),i="<input name='_method' value='"+u+"' type='hidden' />",null==n||null==a||o.isCrossDomain(l)||(i+="<input name='"+n+"' value='"+a+"' type='hidden' />"),i+='<input type="submit" />',r.method="post",r.action=l,r.target=this.target,r.innerHTML=i,r.style.display="none",document.body.appendChild(r),r.querySelector('[type="submit"]').click(),t(e)}}.call(this),function(){var t,e,n,a,r,i,l,u,c,s=[].slice;i=o.matches,n=o.getData,u=o.setData,e=o.fire,c=o.stopEverything,t=o.ajax,a=o.isCrossDomain,l=o.serializeElement,r=function(t){var e;return null!=(e=t.getAttribute("data-remote"))&&"false"!==e},o.handleRemote=function(d){var m,f,p,b,h,v,S;return!r(b=this)||(e(b,"ajax:before")?(S=b.getAttribute("data-with-credentials"),p=b.getAttribute("data-type")||"script",i(b,o.formSubmitSelector)?(m=n(b,"ujs:submit-button"),h=n(b,"ujs:submit-button-formmethod")||b.method,v=n(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,o.buttonClickSelector)||i(b,o.inputChangeSelector)?(h=b.getAttribute("data-method"),v=b.getAttribute("data-url"),f=l(b,b.getAttribute("data-params"))):(h=b.getAttribute("data-method"),v=o.href(b),f=b.getAttribute("data-params")),t({type:h||"GET",url:v,data:f,dataType:p,beforeSend:function(t,n){return e(b,"ajax:beforeSend",[t,n])?e(b,"ajax:send",[t]):(e(b,"ajax:stopped"),!1)},success:function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],e(b,"ajax:success",t)},error:function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],e(b,"ajax:error",t)},complete:function(){var t;return t=1<=arguments.length?s.call(arguments,0):[],e(b,"ajax:complete",t)},crossDomain:a(v),withCredentials:null!=S&&"false"!==S}),c(d)):(e(b,"ajax:stopped"),!1))},o.formSubmitButtonClick=function(t){var e;if(this,e=this.form)return this.name&&u(e,"ujs:submit-button",{name:this.name,value:this.value}),u(e,"ujs:formnovalidate-button",this.formNoValidate),u(e,"ujs:submit-button-formaction",this.getAttribute("formaction")),u(e,"ujs:submit-button-formmethod",this.getAttribute("formmethod"))},o.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 t,e,n,a,r,i,l,u,c,s,d,m,f,p,b;if(i=o.fire,n=o.delegate,u=o.getData,t=o.$,b=o.refreshCSRFTokens,e=o.CSRFProtection,f=o.loadCSPNonce,r=o.enableElement,a=o.disableElement,s=o.handleDisabledElement,c=o.handleConfirm,p=o.preventInsignificantClick,m=o.handleRemote,l=o.formSubmitButtonClick,d=o.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=o,jQuery.ajaxPrefilter((function(t,n,a){if(!t.crossDomain)return e(a)}))}o.start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");return window.addEventListener("pageshow",(function(){return t(o.formEnableSelector).forEach((function(t){if(u(t,"ujs:disabled"))return r(t)})),t(o.linkDisableSelector).forEach((function(t){if(u(t,"ujs:disabled"))return r(t)}))})),n(document,o.linkDisableSelector,"ajax:complete",r),n(document,o.linkDisableSelector,"ajax:stopped",r),n(document,o.buttonDisableSelector,"ajax:complete",r),n(document,o.buttonDisableSelector,"ajax:stopped",r),n(document,o.linkClickSelector,"click",p),n(document,o.linkClickSelector,"click",s),n(document,o.linkClickSelector,"click",c),n(document,o.linkClickSelector,"click",a),n(document,o.linkClickSelector,"click",m),n(document,o.linkClickSelector,"click",d),n(document,o.buttonClickSelector,"click",p),n(document,o.buttonClickSelector,"click",s),n(document,o.buttonClickSelector,"click",c),n(document,o.buttonClickSelector,"click",a),n(document,o.buttonClickSelector,"click",m),n(document,o.inputChangeSelector,"change",s),n(document,o.inputChangeSelector,"change",c),n(document,o.inputChangeSelector,"change",m),n(document,o.formSubmitSelector,"submit",s),n(document,o.formSubmitSelector,"submit",c),n(document,o.formSubmitSelector,"submit",m),n(document,o.formSubmitSelector,"submit",(function(t){return setTimeout((function(){return a(t)}),13)})),n(document,o.formSubmitSelector,"ajax:send",a),n(document,o.formSubmitSelector,"ajax:complete",r),n(document,o.formInputClickSelector,"click",p),n(document,o.formInputClickSelector,"click",s),n(document,o.formInputClickSelector,"click",c),n(document,o.formInputClickSelector,"click",l),document.addEventListener("DOMContentLoaded",b),document.addEventListener("DOMContentLoaded",f),window._rails_loaded=!0},window.Rails===o&&i(document,"rails:attachBindings")&&o.start()}.call(this)}).call(this),t.exports?t.exports=o:void 0===(r="function"==typeof(a=o)?a.call(e,n,e,t):a)||(t.exports=r)}).call(this)},866:function(t,e,n){"use strict";n.r(e),e.default=n.p+"media/flavours/glitch/images/glitch-preview-bb9cc15a0102bfaf65712e5cff7e58df.jpg"},867:function(t,e,n){"use strict";n.r(e),e.default=n.p+"media/flavours/glitch/images/wave-drawer-ee1bfcbe5811ea31771b7187c7507ee6.png"},868:function(t,e,n){"use strict";n.r(e),e.default=n.p+"media/flavours/glitch/images/wave-drawer-glitched-33467bf8c8d2b995d6c76d8810aba3db.png"},948:function(t,e,n){"use strict";n.r(e);var a=n(61);n(949);Object(a.start)(),n(950)},949:function(t,e,n){},950:function(t,e,n){var a={"./glitch-preview":866,"./glitch-preview.jpg":866,"./wave-drawer":867,"./wave-drawer-glitched":868,"./wave-drawer-glitched.png":868,"./wave-drawer.png":867};function r(t){var e=o(t);return n(e)}function o(t){if(!n.o(a,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return a[t]}r.keys=function(){return Object.keys(a)},r.resolve=o,t.exports=r,r.id=950}},[[948,0]]]);
//# sourceMappingURL=common.js.map