akkoma/priv/static/packs/core/modal.js
2020-05-20 07:55:14 +02:00

2 lines
17 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[10,11],{116:function(t,e,n){"use strict";function r(t){["interactive","complete"].includes(document.readyState)?t():document.addEventListener("DOMContentLoaded",t)}n.r(e),n.d(e,"default",(function(){return r}))},272:function(t,e,n){"use strict";t.exports=function(){var t="[\\ud800-\\udfff]",e="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",n="\\ud83c[\\udffb-\\udfff]",r="[^\\ud800-\\udfff]",a="(?:\\uD83C[\\uDDE6-\\uDDFF]){2}",o="[\\ud800-\\udbff][\\udc00-\\udfff]",i="[\\uD83D\\uDC69\\uD83C\\uDFFB\\u200D\\uD83C\\uDF93]",u="(?:"+e+"|"+n+")"+"?",l="[\\ufe0e\\ufe0f]?"+u+("(?:\\u200d(?:"+[r,a,o].join("|")+")[\\ufe0e\\ufe0f]?"+u+")*"),c="(?:"+[""+r+e+"?",e,a,o,t,i].join("|")+")";return new RegExp("(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)|"+n+"(?="+n+")|"+(c+l),"g")}},61:function(t,e,n){var r,a;(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 r,a;if(a=n(),r=e(),null!=a&&null!=r)return t('form input[name="'+r+'"]').forEach((function(t){return t.value=a}))}}.call(this),function(){var t,e,n,r;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,r=t.prototype.preventDefault,t.prototype.preventDefault=function(){var t;return t=r.call(this),this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),t}),e=o.fire=function(e,n,r){var a;return a=new t(n,{bubbles:!0,cancelable:!0,detail:r}),e.dispatchEvent(a),!a.defaultPrevented},o.stopEverything=function(t){return e(t.target,"ujs:everythingStopped"),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()},o.delegate=function(t,e,r,a){return t.addEventListener(r,(function(t){var r;for(r=t.target;r instanceof Element&&!n(r,e);)r=r.parentNode;if(r instanceof Element&&!1===a.call(r,t))return t.preventDefault(),t.stopPropagation()}))}}.call(this),function(){var t,e,n,r,a,i;r=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=a(t),e=n(t,(function(){var n,r;return r=i(null!=(n=e.response)?n:e.responseText,e.getResponseHeader("Content-Type")),2===Math.floor(e.status/100)?"function"==typeof t.success&&t.success(r,e.statusText,e):"function"==typeof t.error&&t.error(r,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)},a=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 r;return(r=new XMLHttpRequest).open(t.type,t.url,!0),r.setRequestHeader("Accept",t.accept),"string"==typeof t.data&&r.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),t.crossDomain||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),e(r),r.withCredentials=!!t.withCredentials,r.onreadystatechange=function(){if(r.readyState===XMLHttpRequest.DONE)return n(r)},r},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},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,r){var a,o;return a=[n],t(n,"form")&&(a=e(n.elements)),o=[],a.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})),r&&o.push(r),o.map((function(t){return null!=t.name?encodeURIComponent(t.name)+"="+encodeURIComponent(t.value):t})).join("&")},o.formElements=function(n,r){return t(n,"form")?e(n.elements).filter((function(e){return t(e,r)})):e(n.querySelectorAll(r))}}.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,r,a;if(!(a=t.getAttribute("data-confirm")))return!0;if(n=!1,e(t,"confirm")){try{n=o.confirm(a,t)}catch(t){}r=e(t,"confirm:complete",[n])}return n&&r}}.call(this),function(){var t,e,n,r,a,i,u,l,c,s,d,f;s=o.matches,l=o.getData,d=o.setData,f=o.stopEverything,u=o.formElements,o.handleDisabledElement=function(t){if(this,this.disabled)return f(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)?r(e):s(e,o.formSubmitSelector)?a(e):void 0},o.disableElement=function(r){var a;return a=r instanceof Event?r.target:r,s(a,o.linkDisableSelector)?n(a):s(a,o.buttonDisableSelector)||s(a,o.formDisableSelector)?t(a):s(a,o.formSubmitSelector)?e(a):void 0},n=function(t){var e;if(!l(t,"ujs:disabled"))return null!=(e=t.getAttribute("data-disable-with"))&&(d(t,"ujs:enable-with",t.innerHTML),t.innerHTML=e),t.addEventListener("click",f),d(t,"ujs:disabled",!0)},i=function(t){var e;return null!=(e=l(t,"ujs:enable-with"))&&(t.innerHTML=e,d(t,"ujs:enable-with",null)),t.removeEventListener("click",f),d(t,"ujs:disabled",null)},e=function(e){return u(e,o.formDisableSelector).forEach(t)},t=function(t){var e;if(!l(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)},a=function(t){return u(t,o.formEnableSelector).forEach(r)},r=function(t){var e;return null!=(e=l(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,r,a,i,u,l;if(this,l=this.getAttribute("data-method"))return u=o.href(this),r=o.csrfToken(),n=o.csrfParam(),a=document.createElement("form"),i="<input name='_method' value='"+l+"' type='hidden' />",null==n||null==r||o.isCrossDomain(u)||(i+="<input name='"+n+"' value='"+r+"' type='hidden' />"),i+='<input type="submit" />',a.method="post",a.action=u,a.target=this.target,a.innerHTML=i,a.style.display="none",document.body.appendChild(a),a.querySelector('[type="submit"]').click(),t(e)}}.call(this),function(){var t,e,n,r,a,i,u,l,c,s=[].slice;i=o.matches,n=o.getData,l=o.setData,e=o.fire,c=o.stopEverything,t=o.ajax,r=o.isCrossDomain,u=o.serializeElement,a=function(t){var e;return null!=(e=t.getAttribute("data-remote"))&&"false"!==e},o.handleRemote=function(d){var f,m,p,b,h,v,g;return!a(b=this)||(e(b,"ajax:before")?(g=b.getAttribute("data-with-credentials"),p=b.getAttribute("data-type")||"script",i(b,o.formSubmitSelector)?(f=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?(m=new FormData(b),null!=f&&m.append(f.name,f.value)):m=u(b,f),l(b,"ujs:submit-button",null),l(b,"ujs:submit-button-formmethod",null),l(b,"ujs:submit-button-formaction",null)):i(b,o.buttonClickSelector)||i(b,o.inputChangeSelector)?(h=b.getAttribute("data-method"),v=b.getAttribute("data-url"),m=u(b,b.getAttribute("data-params"))):(h=b.getAttribute("data-method"),v=o.href(b),m=b.getAttribute("data-params")),t({type:h||"GET",url:v,data:m,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:r(v),withCredentials:null!=g&&"false"!==g}),c(d)):(e(b,"ajax:stopped"),!1))},o.formSubmitButtonClick=function(t){var e;if(this,e=this.form)return this.name&&l(e,"ujs:submit-button",{name:this.name,value:this.value}),l(e,"ujs:formnovalidate-button",this.formNoValidate),l(e,"ujs:submit-button-formaction",this.getAttribute("formaction")),l(e,"ujs:submit-button-formmethod",this.getAttribute("formmethod"))},o.preventInsignificantClick=function(t){var e,n,r;if(this,r=(this.getAttribute("data-method")||"GET").toUpperCase(),e=this.getAttribute("data-params"),n=(t.metaKey||t.ctrlKey)&&"GET"===r&&!e,null!=t.button&&0!==t.button||n)return t.stopImmediatePropagation()}}.call(this),function(){var t,e,n,r,a,i,u,l,c,s,d,f,m,p,b;if(i=o.fire,n=o.delegate,l=o.getData,t=o.$,b=o.refreshCSRFTokens,e=o.CSRFProtection,m=o.loadCSPNonce,a=o.enableElement,r=o.disableElement,s=o.handleDisabledElement,c=o.handleConfirm,p=o.preventInsignificantClick,f=o.handleRemote,u=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,r){if(!t.crossDomain)return e(r)}))}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(l(t,"ujs:disabled"))return a(t)})),t(o.linkDisableSelector).forEach((function(t){if(l(t,"ujs:disabled"))return a(t)}))})),n(document,o.linkDisableSelector,"ajax:complete",a),n(document,o.linkDisableSelector,"ajax:stopped",a),n(document,o.buttonDisableSelector,"ajax:complete",a),n(document,o.buttonDisableSelector,"ajax:stopped",a),n(document,o.linkClickSelector,"click",p),n(document,o.linkClickSelector,"click",s),n(document,o.linkClickSelector,"click",c),n(document,o.linkClickSelector,"click",r),n(document,o.linkClickSelector,"click",f),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",r),n(document,o.buttonClickSelector,"click",f),n(document,o.inputChangeSelector,"change",s),n(document,o.inputChangeSelector,"change",c),n(document,o.inputChangeSelector,"change",f),n(document,o.formSubmitSelector,"submit",s),n(document,o.formSubmitSelector,"submit",c),n(document,o.formSubmitSelector,"submit",f),n(document,o.formSubmitSelector,"submit",(function(t){return setTimeout((function(){return r(t)}),13)})),n(document,o.formSubmitSelector,"ajax:send",r),n(document,o.formSubmitSelector,"ajax:complete",a),n(document,o.formInputClickSelector,"click",p),n(document,o.formInputClickSelector,"click",s),n(document,o.formInputClickSelector,"click",c),n(document,o.formInputClickSelector,"click",u),document.addEventListener("DOMContentLoaded",b),document.addEventListener("DOMContentLoaded",m),window._rails_loaded=!0},window.Rails===o&&i(document,"rails:attachBindings")&&o.start()}.call(this)}).call(this),t.exports?t.exports=o:void 0===(a="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=a)}).call(this)},740:function(t,e,n){"use strict";n.r(e);n(116);var r=n(61).delegate;n(79).length;r(document,".webapp-btn","click",(function(t){var e=t.target;return 0!==t.button||(window.location.href=e.href,!1)})),r(document,".modal-button","click",(function(t){var e;t.preventDefault(),e="A"!==t.target.nodeName?t.target.parentNode.href:t.target.href,window.open(e,"mastodon-intent","width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes")}));var a=function(t){return function(e){var n=e.target,r=n.getAttribute(t);"true"!==n.getAttribute("data-autoplay")&&n.src!==r&&(n.src=r)}};r(document,"img#profile_page_avatar","mouseover",a("data-original")),r(document,"img#profile_page_avatar","mouseout",a("data-static")),r(document,"#account_header","change",(function(t){var e=t.target,n=document.querySelector(".card .card__img img"),r=(e.files||[])[0],a=r?URL.createObjectURL(r):n.dataset.originalSrc;n.src=a}))},79:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(n(272));function o(t){if("string"!=typeof t)throw new Error("A string is expected as input");return t.match(a.default())||[]}function i(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=t.match(a.default());return null===e?0:e.length}function u(t,e,n){if(void 0===e&&(e=0),"string"!=typeof t)throw new Error("Input must be a string");("number"!=typeof e||e<0)&&(e=0),"number"==typeof n&&n<0&&(n=0);var r=t.match(a.default());return r?r.slice(e,n).join(""):""}e.toArray=o,e.length=i,e.substring=u,e.substr=function(t,e,n){if(void 0===e&&(e=0),"string"!=typeof t)throw new Error("Input must be a string");var r,o=i(t);if("number"!=typeof e&&(e=parseInt(e,10)),e>=o)return"";e<0&&(e+=o),void 0===n?r=o:("number"!=typeof n&&(n=parseInt(n,10)),r=n>=0?n+e:e);var u=t.match(a.default());return u?u.slice(e,r).join(""):""},e.limit=function(t,e,n,r){if(void 0===e&&(e=16),void 0===n&&(n="#"),void 0===r&&(r="right"),"string"!=typeof t||"number"!=typeof e)throw new Error("Invalid arguments specified");if(-1===["left","right"].indexOf(r))throw new Error("Pad position should be either left or right");"string"!=typeof n&&(n=String(n));var a=i(t);if(a>e)return u(t,0,e);if(a<e){var o=n.repeat(e-a);return"left"===r?o+t:t+o}return t},e.indexOf=function(t,e,n){if(void 0===n&&(n=0),"string"!=typeof t)throw new Error("Input must be a string");if(""===t)return""===e?0:-1;n=Number(n),n=isNaN(n)?0:n,e=String(e);var r=o(t);if(n>=r.length)return""===e?r.length:-1;if(""===e)return n;var a,i=o(e),u=!1;for(a=n;a<r.length;a+=1){for(var l=0;l<i.length&&i[l]===r[a+l];)l+=1;if(l===i.length&&i[l-1]===r[a+l-1]){u=!0;break}}return u?a:-1}}},[[740,0]]]);
//# sourceMappingURL=modal.js.map